This is an automated email from the ASF dual-hosted git repository.
fokko pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/iceberg-rust.git
The following commit(s) were added to refs/heads/main by this push:
new e073e75b Suport conversion of Arrow Int8 and Int16 to Iceberg Int
(#787)
e073e75b is described below
commit e073e75bf51fd4e8999e9d99a9986a4380afd0bc
Author: Marko Grujic <[email protected]>
AuthorDate: Thu Dec 12 15:12:32 2024 +0100
Suport conversion of Arrow Int8 and Int16 to Iceberg Int (#787)
Also convert the new Utf8View to String type.
---
crates/iceberg/src/arrow/schema.rs | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/crates/iceberg/src/arrow/schema.rs
b/crates/iceberg/src/arrow/schema.rs
index 4de9335d..91dfe85e 100644
--- a/crates/iceberg/src/arrow/schema.rs
+++ b/crates/iceberg/src/arrow/schema.rs
@@ -367,7 +367,9 @@ impl ArrowSchemaVisitor for ArrowSchemaConverter {
fn primitive(&mut self, p: &DataType) -> Result<Self::T> {
match p {
DataType::Boolean => Ok(Type::Primitive(PrimitiveType::Boolean)),
- DataType::Int32 => Ok(Type::Primitive(PrimitiveType::Int)),
+ DataType::Int8 | DataType::Int16 | DataType::Int32 => {
+ Ok(Type::Primitive(PrimitiveType::Int))
+ }
DataType::Int64 => Ok(Type::Primitive(PrimitiveType::Long)),
DataType::Float32 => Ok(Type::Primitive(PrimitiveType::Float)),
DataType::Float64 => Ok(Type::Primitive(PrimitiveType::Double)),
@@ -404,7 +406,9 @@ impl ArrowSchemaVisitor for ArrowSchemaConverter {
DataType::FixedSizeBinary(width) => {
Ok(Type::Primitive(PrimitiveType::Fixed(*width as u64)))
}
- DataType::Utf8 | DataType::LargeUtf8 =>
Ok(Type::Primitive(PrimitiveType::String)),
+ DataType::Utf8View | DataType::Utf8 | DataType::LargeUtf8 => {
+ Ok(Type::Primitive(PrimitiveType::String))
+ }
_ => Err(Error::new(
ErrorKind::DataInvalid,
format!("Unsupported Arrow data type: {p}"),