paleolimbot commented on code in PR #1116:
URL: https://github.com/apache/sedona-db/pull/1116#discussion_r3738722622
##########
rust/sedona-geoparquet/src/format.rs:
##########
@@ -391,7 +391,34 @@ impl FileFormat for GeoParquetFormat {
)
.unwrap();
source.options = self.options.clone();
- Arc::new(source)
+
+ // DataFusion 52 has an issue where field metadata (like
ARROW:extension:name)
+ // is stripped when evaluating embedded projections in ParquetOpener.
This is
+ // because the batch schema comes from the parquet reader (which
doesn't have
+ // extension metadata), and Column::return_field() looks up fields
from that schema.
+ // This isn't a bug in DataFusion because we're the ones that
advertised the table
+ // schema as having metadata'd expressions in the first place.
+ //
+ // We fix this by wrapping Column expressions with
MetadataPreservingColumn,
+ // which stores the correct field from the file schema and returns it
from
+ // return_field() regardless of the input schema.
+ let initial_projection =
source.projection().cloned().unwrap_or_else(|| {
+ let indices: Vec<usize> =
+
(0..source.table_schema().table_schema().fields().len()).collect();
+ ProjectionExprs::from_indices(&indices,
source.table_schema().table_schema())
Review Comment:
We shouldn't hit this case, but if that gets removed on upgrade and set to
None at least it's still correct.
--
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]