kosiew commented on code in PR #20202:
URL: https://github.com/apache/datafusion/pull/20202#discussion_r2839461314


##########
datafusion/physical-expr-adapter/src/schema_rewriter.rs:
##########
@@ -468,7 +468,10 @@ impl DefaultPhysicalExprAdapterRewriter {
         column: Column,
         logical_field: &Field,
     ) -> Result<Transformed<Arc<dyn PhysicalExpr>>> {
-        let actual_physical_field = 
self.physical_file_schema.field(column.index());
+        // Look up the column index in the physical schema by name to ensure 
correctness
+        let physical_column_index = 
self.physical_file_schema.index_of(column.name())?;
+        let actual_physical_field =
+            self.physical_file_schema.field(physical_column_index);

Review Comment:
   Good point.
   
   Created PR - https://github.com/apache/datafusion/pull/20485



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