nuno-faria commented on code in PR #25549:
URL: https://github.com/apache/datafusion/pull/25549#discussion_r4116047420
##########
datafusion/sql/src/unparser/plan.rs:
##########
@@ -1243,6 +1244,12 @@ impl Unparser<'_> {
select.selection(Some(filter_expr));
}
+ // if the inner plan aliases columns used by the filter, we
need to convert to a
+ // subquery to prevent invalid references
+ if filter_depends_on_input_alias(filter) {
+ return self.derive(&filter.input, relation, None, false);
Review Comment:
Thanks @kumarUjjawal for the review, I added both suggestions. I didn't
re-plan the queries but I tested the SQL in MySQL and it works (replacing
random() -> rand() first).
--
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]