Skip to content

Commit

Permalink
Suport conversion of Arrow Int8 and Int16 to Iceberg Int (#787)
Browse files Browse the repository at this point in the history
Also convert the new Utf8View to String type.
  • Loading branch information
gruuya authored Dec 12, 2024
1 parent 15f3ae6 commit e073e75
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions crates/iceberg/src/arrow/schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)),
Expand Down Expand Up @@ -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}"),
Expand Down

0 comments on commit e073e75

Please sign in to comment.