alamb commented on code in PR #22915:
URL: https://github.com/apache/datafusion/pull/22915#discussion_r3398485702
##########
datafusion/sqllogictest/test_files/subquery.slt:
##########
@@ -1660,6 +1598,25 @@ logical_plan
21)----------Projection: column1 AS v
22)------------Values: (Int64(5)), (Int64(NULL))
+# same-table `= ANY` / `<> ALL` must plan without
Review Comment:
without the code change in this PR, this test fails as expected
```shell
cargo test --profile=ci --test sqllogictests
...
Completed 475 test files in 9 seconds
External error: 2 errors in file
/Users/andrewlamb/Software/datafusion3/datafusion/sqllogictest/test_files/subquery.slt
1. query failed: DataFusion error: Optimizer rule 'optimize_projections'
failed
caused by
Schema error: Schema contains duplicate unqualified field name mark
[SQL] select id from set_cmp_self where age = any(select age from
set_cmp_self);
at
/Users/andrewlamb/Software/datafusion3/datafusion/sqllogictest/test_files/subquery.slt:1606
2. query failed: DataFusion error: Optimizer rule 'optimize_projections'
failed
caused by
Schema error: Schema contains duplicate unqualified field name mark
[SQL] select id from set_cmp_self where age <> all(select age from
set_cmp_self);
at
/Users/andrewlamb/Software/datafusion3/datafusion/sqllogictest/test_files/subquery.slt:1613
```
##########
datafusion/optimizer/src/optimize_projections/mod.rs:
##########
@@ -764,12 +780,12 @@ fn split_join_requirements(
// The mark column is synthetic (produced by the join itself),
// so discard it and route only to the left child.
let (left_indices, _mark) = indices.split_off(left_len);
- (left_indices, RequiredIndices::new())
+ (left_indices, RequiredIndices::new().append(&[0]))
Review Comment:
It seems like we only need to add the column in some cases -- why does this
code add it unconditionally?
--
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]