ctsk commented on PR #16083: URL: https://github.com/apache/datafusion/pull/16083#issuecomment-2923436003
After updating `JoinType::supports_swap` to include LeftMark/RightMark join, the join_selection rule *should* already plan right joins where appropriate. Subsequently running the sqllogictests (`cargo test --test sqllogictests`) reveals some failures: <details> ``` External error: 6 errors in file [...]/datafusion/datafusion/sqllogictest/test_files/subquery.slt 1. query failed: DataFusion error: join_selection caused by Internal error: Input field name t1_name does not match with the projection expression t1_id. This was likely caused by a bug in DataFusion's code and we would welcome that you file an bug report in our issue tracker [SQL] select t1.t1_id, t1.t1_name, t1.t1_int from t1 where t1.t1_id > 40 or t1.t1_id in (select t2.t2_id from t2 where t1.t1_int > 0) at [...]/datafusion/datafusion/sqllogictest/test_files/subquery.slt:1108 2. query failed: DataFusion error: join_selection caused by Internal error: Input field name t1_name does not match with the projection expression t1_id. This was likely caused by a bug in DataFusion's code and we would welcome that you file an bug report in our issue tracker [SQL] select t1.t1_id, t1.t1_name, t1.t1_int from t1 where t1.t1_id = 11 or t1.t1_id + 12 not in (select t2.t2_id + 1 from t2 where t1.t1_int > 0) at [...]/datafusion/datafusion/sqllogictest/test_files/subquery.slt:1136 3. query failed: DataFusion error: join_selection caused by Internal error: Input field name t1_name does not match with the projection expression t1_id. This was likely caused by a bug in DataFusion's code and we would welcome that you file an bug report in our issue tracker [SQL] select t1.t1_id, t1.t1_name, t1.t1_int from t1 where t1.t1_id > 40 or exists (select * from t2 where t1.t1_id = t2.t2_id) at [...]/datafusion/datafusion/sqllogictest/test_files/subquery.slt:1162 4. query result mismatch: [SQL] explain select t1.t1_id, t1.t1_name, t1.t1_int from t1 where t1.t1_id > 40 or not exists (select * from t2 where t1.t1_id = t2.t2_id) [Diff] (-expected|+actual) logical_plan 01)Projection: t1.t1_id, t1.t1_name, t1.t1_int 02)--Filter: t1.t1_id > Int32(40) OR NOT __correlated_sq_1.mark 03)----LeftMark Join: t1.t1_id = __correlated_sq_1.t2_id 04)------TableScan: t1 projection=[t1_id, t1_name, t1_int] 05)------SubqueryAlias: __correlated_sq_1 - 06)--------TableScan: t2 projection=[t2_id] - physical_plan - 01)CoalesceBatchesExec: target_batch_size=2 - 02)--FilterExec: t1_id@0 > 40 OR NOT mark@3, projection=[t1_id@0, t1_name@1, t1_int@2] - 03)----CoalesceBatchesExec: target_batch_size=2 - 04)------HashJoinExec: mode=CollectLeft, join_type=LeftMark, on=[(t1_id@0, t2_id@0)] - 05)--------DataSourceExec: partitions=1, partition_sizes=[1] - 06)--------RepartitionExec: partitioning=RoundRobinBatch(4), input_partitions=1 - 07)----------DataSourceExec: partitions=1, partition_sizes=[1] + 06)--------TableScan: t2 projection=[t2_id] at [...]/datafusion/datafusion/sqllogictest/test_files/subquery.slt:1177 5. query failed: DataFusion error: join_selection caused by Internal error: Input field name t1_name does not match with the projection expression t1_id. This was likely caused by a bug in DataFusion's code and we would welcome that you file an bug report in our issue tracker [SQL] select t1.t1_id, t1.t1_name, t1.t1_int from t1 where t1.t1_id > 40 or not exists (select * from t2 where t1.t1_id = t2.t2_id) at [...]/datafusion/datafusion/sqllogictest/test_files/subquery.slt:1203 6. query failed: DataFusion error: join_selection caused by Internal error: Input field name t1_name does not match with the projection expression t1_id. This was likely caused by a bug in DataFusion's code and we would welcome that you file an bug report in our issue tracker [SQL] select t1.t1_id, t1.t1_name, t1.t1_int from t1 where t1.t1_id > 40 or exists (select * from t2 cross join t3 where t1.t1_id = t2.t2_id) at [...]/datafusion/datafusion/sqllogictest/test_files/subquery.slt:1244 External error: task 14575 panicked with message "index out of bounds: the len is 6 but the index is 6" External error: task 17017 panicked with message "index out of bounds: the len is 6 but the index is 6" Error: Execution("3 failures") error: test failed, to rerun pass `-p datafusion-sqllogictest --test sqllogictests` </details> -- 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: github-unsubscr...@datafusion.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org For additional commands, e-mail: github-h...@datafusion.apache.org