OIiveirra commented on code in PR #69032:
URL: https://github.com/apache/doris/pull/69032#discussion_r4559217513


##########
be/src/format_v2/parquet/parquet_column_schema.cpp:
##########
@@ -329,6 +329,29 @@ Status build_parquet_column_schema(const 
NativeFieldDescriptor& schema,
     return Status::OK();
 }
 
+bool apply_spatial_binary_types(format::ColumnDefinition* column, 
ParquetColumnSchema* schema) {
+    DORIS_CHECK(column->local_id == schema->local_id);
+    // A table-mapped BINARY leaf may have a spatial native annotation. Update 
the split-local
+    // reader schema used by both dictionary and plain-page readers, leaving 
the footer cache alone.
+    const auto physical_type = 
remove_nullable(schema->type)->get_primitive_type();
+    if ((physical_type == TYPE_GEOMETRY || physical_type == TYPE_GEOGRAPHY) &&
+        remove_nullable(column->type)->get_primitive_type() == TYPE_VARBINARY) 
{
+        schema->type = schema->type->is_nullable() ? column->type : 
remove_nullable(column->type);
+        schema->type_descriptor.doris_type = schema->type;
+        return true;
+    }
+    bool changed = false;
+    for (size_t i = 0; i < column->children.size(); ++i) {
+        changed |= apply_spatial_binary_types(&column->children[i], 
schema->children[i].get());
+    }
+    // A STRUCT containing an overridden leaf needs the same field type in 
both schemas.
+    if (changed) {
+        rebuild_logical_complex_type(schema, true);
+        column->type = make_nullable(schema->type);

Review Comment:
   Fixed in 4d7ce45ce69. When an annotated BINARY equality-delete leaf is 
overridden, the native Parquet schema now keeps the current split-local types 
for every sibling before rebuilding the parent STRUCT. A TIMESTAMPTZ sibling 
therefore remains TIMESTAMPTZ when \`enable_mapping_timestamp_tz=false\`. The 
regression covers this schema combination, and 213 targeted Iceberg/Parquet BE 
tests pass.



-- 
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]

Reply via email to