vbarua commented on code in PR #17299:
URL: https://github.com/apache/datafusion/pull/17299#discussion_r2323680328


##########
datafusion/substrait/src/logical_plan/consumer/rel/project_rel.rs:
##########
@@ -62,7 +62,17 @@ pub async fn from_project_rel(
                 // to transform it into a column reference
                 window_exprs.insert(e.clone());
             }
-            explicit_exprs.push(name_tracker.get_uniquely_named_expr(e)?);
+            // Since substrait removes aliases, we need to assign literals 
with a UUID alias to avoid
+            // ambiguous names when the same literal is used before and after 
a join.

Review Comment:
   > which means literals columns are just assigned their default names
   
   Ok yeah, I figured there was some sort of default name thing going on. 
Another way to phrase this might be:
   
   > Substrait plans are ordinal based, so they do not provide names for 
columns. Names for columns are generated by Datafusion during conversion, and 
for literals Datafusion produces names based on the literal value. It is 
possible to construct valid Substrait plans that result in duplicated names if 
the same literal value is used in multiple relations. To avoid this issue, we 
alias literals with unique names.
   



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