sunchao commented on code in PR #24680:
URL: https://github.com/apache/datafusion/pull/24680#discussion_r3865185070


##########
datafusion/physical-expr-adapter/src/schema_rewriter.rs:
##########
@@ -271,6 +272,9 @@ impl PhysicalExprAdapter for DefaultPhysicalExprAdapter {
 struct DefaultPhysicalExprAdapterRewriter {
     logical_file_schema: SchemaRef,
     physical_file_schema: SchemaRef,
+    // Retain generated casts so their pointer identity remains reliable even
+    // after a wider cast has been removed from the expression tree.
+    generated_struct_casts: HashMap<*const (), Arc<dyn PhysicalExpr>>,

Review Comment:
   Thanks, clarified in 801bb0ecee511460488da866318a44ee4a5f5149. The comment 
now documents bottom-up `transform` traversal, a fresh tracker per `rewrite()`, 
and retained `Arc` ownership. It also explains why provenance stays local 
instead of adding markers to expression types or threading it through rewrite 
results. I kept the existing implementation; this follow-up only changes 
comments.



##########
datafusion/physical-expr-adapter/src/schema_rewriter.rs:
##########
@@ -309,26 +313,58 @@ fn resolve_field_path<'a>(
     }
 }
 
+/// Retain a field path without changing its ancestors' metadata or 
nullability.
+fn retain_field_path(field: &FieldRef, path: &[&str]) -> Option<FieldRef> {

Review Comment:
   Updated in 801bb0ecee511460488da866318a44ee4a5f5149. The doc comment now 
explains that the helper trims the cast target to exclude unselected sibling 
conversions while retaining the Struct ancestors, their metadata and 
nullability, and the all-null shortcut. I kept the helper name unchanged to 
keep this follow-up limited to documentation.



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