Skip to content
This repository has been archived by the owner on Aug 13, 2024. It is now read-only.

Commit

Permalink
convert iceberg binary to arrow binary
Browse files Browse the repository at this point in the history
  • Loading branch information
chenzl25 committed Feb 28, 2024
1 parent 56943d2 commit 905207b
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions icelake/src/types/arrow/to_arrow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ impl TryFrom<types::Primitive> for ArrowDataType {
Ok(ArrowDataType::LargeBinary)
}
}
types::Primitive::Binary => Ok(ArrowDataType::LargeBinary),
types::Primitive::Binary => Ok(ArrowDataType::Binary),
}
}
}
Expand Down Expand Up @@ -172,15 +172,27 @@ mod tests {
write_default: None,
}
.into(),
types::Field {
name: "binary_data".to_string(),
field_type: types::Any::Primitive(types::Primitive::Binary),
id: 2,
required: false,
comment: None,
initial_default: None,
write_default: None,
}
.into(),
]),
);

let arrow_schema = ArrowSchema::try_from(schema).unwrap();

assert_eq!(arrow_schema.fields().len(), 2);
assert_eq!(arrow_schema.fields().len(), 3);
assert_eq!(arrow_schema.fields()[0].name(), "id");
assert_eq!(arrow_schema.fields()[0].data_type(), &ArrowDataType::Int64);
assert_eq!(arrow_schema.fields()[1].name(), "data");
assert_eq!(arrow_schema.fields()[1].data_type(), &ArrowDataType::Utf8);
assert_eq!(arrow_schema.fields()[2].name(), "binary_data");
assert_eq!(arrow_schema.fields()[2].data_type(), &ArrowDataType::Binary);
}
}

0 comments on commit 905207b

Please sign in to comment.