blackmwk commented on code in PR #2188:
URL: https://github.com/apache/iceberg-rust/pull/2188#discussion_r3432938532
##########
crates/iceberg/src/arrow/schema.rs:
##########
@@ -692,6 +692,16 @@ impl SchemaVisitor for ToArrowSchemaConverter {
}
}
}
+
+ fn variant(&mut self, _v: &VariantType) ->
crate::Result<ArrowSchemaOrFieldOrType> {
+ // Variant is stored as a struct with two required binary fields (no
field IDs on sub-fields).
+ // Uses Binary (not LargeBinary) matching the Parquet BINARY primitive
directly.
+ let metadata_field = Field::new("metadata", DataType::Binary, false);
+ let value_field = Field::new("value", DataType::Binary, false);
Review Comment:
This should be nullable, also we need to attach the extension type using
`field.with_extension_type`
##########
crates/iceberg/src/writer/file_writer/parquet_writer.rs:
##########
Review Comment:
Similarly I prefer to move this to a standalone pr since it's difficult to
understand.
##########
crates/iceberg/src/avro/schema.rs:
##########
@@ -37,18 +37,55 @@ const FIELD_ID_PROP: &str = "field-id";
const KEY_ID: &str = "key-id";
const VALUE_ID: &str = "value-id";
const MAP_LOGICAL_TYPE: &str = "map";
+const VARIANT_LOGICAL_TYPE: &str = "variant";
// This const may better to maintain in avro-rs.
const LOGICAL_TYPE: &str = "logicalType";
struct SchemaToAvroSchema {
schema: String,
+ // Stack of enclosing field ids, used to derive unique record names for
+ // structural types (e.g. variant) — mirrors Java TypeToSchema.fieldIds.
+ field_ids: Vec<i32>,
}
type AvroSchemaOrField = Either<AvroSchema, AvroRecordField>;
impl SchemaVisitor for SchemaToAvroSchema {
type T = AvroSchemaOrField;
+ fn before_struct_field(&mut self, field: &NestedFieldRef) -> Result<()> {
Review Comment:
Why we need this change? Why we can't just return AvroSchema as we did for
primitive?
##########
crates/iceberg/src/arrow/reader/projection.rs:
##########
Review Comment:
This file is too large and I need some time to understand it. I suggest to
move it to a standalone pr, and return error for now.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]