Gentoli commented on issue #3681: URL: https://github.com/apache/arrow-datafusion/issues/3681#issuecomment-1269242046
AFAIK if the query is all SQL, even with an nested select, it still works
correctly
```
ctx.sql("select id from (select test.name_1 as name_1, id from test join
test2 on test.name_1 = test2.name_2) where name_1 = 'andrew'").await.unwrap()
.explain(false, false).unwrap().show().await.unwrap();
```
<details>
<summary>Plan</summary>
```
+---------------+----------------------------------------------------------------------------------------------------------------------------------------------------------+
| plan_type | plan
|
+---------------+----------------------------------------------------------------------------------------------------------------------------------------------------------+
| logical_plan | Projection: #test2.id
|
| | Projection: #test.name_1 AS name_1, #test2.id
|
| | Inner Join: #test.name_1 = #test2.name_2
|
| | Filter: #test.name_1 = Utf8("andrew")
|
| | TableScan: test projection=[name_1],
partial_filters=[#test.name_1 = Utf8("andrew")]
|
| | Filter: #test2.name_2 = Utf8("andrew")
|
| | TableScan: test2 projection=[name_2, id],
partial_filters=[#test2.name_2 = Utf8("andrew")]
|
| physical_plan | ProjectionExec: expr=[id@1 as id]
|
| | ProjectionExec: expr=[name_1@0 as name_1, id@2 as id]
|
| | CoalesceBatchesExec: target_batch_size=4096
|
| | HashJoinExec: mode=Partitioned, join_type=Inner,
on=[(Column { name: "name_1", index: 0 }, Column { name: "name_2", index: 0 })]
|
| | CoalesceBatchesExec: target_batch_size=4096
|
| | RepartitionExec: partitioning=Hash([Column {
name: "name_1", index: 0 }], 12)
|
| | CoalesceBatchesExec: target_batch_size=4096
|
| | FilterExec: name_1@0 = andrew
|
| | RepartitionExec:
partitioning=RoundRobinBatch(12)
|
| | CsvExec: files=[<>/test.csv],
has_header=true, limit=None, projection=[name_1] |
| | CoalesceBatchesExec: target_batch_size=4096
|
| | RepartitionExec: partitioning=Hash([Column {
name: "name_2", index: 0 }], 12)
|
| | CoalesceBatchesExec: target_batch_size=4096
|
| | FilterExec: name_2@0 = andrew
|
| | RepartitionExec:
partitioning=RoundRobinBatch(12)
|
| | CsvExec: files=[<>/test2.csv],
has_header=true, limit=None, projection=[name_2, id] |
| |
|
+---------------+----------------------------------------------------------------------------------------------------------------------------------------------------------+
```
</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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
