alamb commented on code in PR #8425:
URL: https://github.com/apache/arrow-datafusion/pull/8425#discussion_r1416248303
##########
datafusion/sql/tests/sql_integration.rs:
##########
@@ -3546,9 +3546,9 @@ fn test_select_unsupported_syntax_errors(#[case] sql:
&str, #[case] error: &str)
fn select_order_by_with_cast() {
let sql =
"SELECT first_name AS first_name FROM (SELECT first_name AS first_name
FROM person) ORDER BY CAST(first_name as INT)";
- let expected = "Sort: CAST(first_name AS first_name AS Int32) ASC NULLS
LAST\
- \n Projection: first_name AS first_name\
- \n Projection: person.first_name AS first_name\
+ let expected = "Sort: CAST(person.first_name AS Int32) ASC NULLS LAST\
Review Comment:
this certainly looks better
##########
datafusion/sql/src/select.rs:
##########
@@ -384,7 +384,11 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> {
&[&[plan.schema()]],
&plan.using_columns()?,
)?;
- let expr = col.alias(self.normalizer.normalize(alias));
+ let name = self.normalizer.normalize(alias);
+ let expr = match &col {
Review Comment:
Can you please add a comment here about what this is doing? I think it is
avoiding adding an alias if the column name is the same.
Do we have to worry about relation names here too (like what if
`column.relation` is non null?)
--
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]