Copilot commented on code in PR #1116:
URL: https://github.com/apache/sedona-db/pull/1116#discussion_r3728786024


##########
rust/sedona-geoparquet/src/format.rs:
##########
@@ -391,7 +391,32 @@ 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(|| {
+            ProjectionExprs::from_indices(&[0], 
source.table_schema().table_schema())
+        });

Review Comment:
   When `source.projection()` is `None`, this constructs a projection for only 
column 0 and pushes it down. That can silently change scan semantics for 
queries that otherwise read all columns (e.g. `SELECT *`) by dropping the 
remaining columns.



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

Reply via email to