-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
logical_paln unexpected
Aggregate: groupBy=[[t2.a]], aggr=[[COUNT(UInt8(1))]]
it's should
Aggregate: groupBy=[[]], aggr=[[COUNT(UInt8(1))]]
select a,b from t1 where (select count(*) from t2 where t1.a = t2.a)>0;
+---------------+----------------------------------------------------------------------------------------------------------------------------+
| plan_type | plan |
+---------------+----------------------------------------------------------------------------------------------------------------------------+
| logical_plan | Projection: t1.a, t1.b |
| | Inner Join: t1.a = __scalar_sq_1.a |
| | TableScan: t1 projection=[a, b] |
| | SubqueryAlias: __scalar_sq_1 |
| | Projection: t2.a |
| | Filter: COUNT(UInt8(1)) > Int64(0) |
| | Aggregate: groupBy=[[t2.a]], aggr=[[COUNT(UInt8(1))]] |
| | TableScan: t2 projection=[a] |
| physical_plan | ProjectionExec: expr=[a@0 as a, b@1 as b] |
| | CoalesceBatchesExec: target_batch_size=8192 |
| | HashJoinExec: mode=Partitioned, join_type=Inner, on=[(Column { name: "a", index: 0 }, Column { name: "a", index: 0 })] |
| | CoalesceBatchesExec: target_batch_size=8192 |
| | RepartitionExec: partitioning=Hash([Column { name: "a", index: 0 }], 8), input_partitions=8 |
| | RepartitionExec: partitioning=RoundRobinBatch(8), input_partitions=1 |
| | MemoryExec: partitions=1, partition_sizes=[1] |
| | ProjectionExec: expr=[a@0 as a] |
| | CoalesceBatchesExec: target_batch_size=8192 |
| | FilterExec: COUNT(UInt8(1))@1 > 0 |
| | AggregateExec: mode=FinalPartitioned, gby=[a@0 as a], aggr=[COUNT(UInt8(1))] |
| | CoalesceBatchesExec: target_batch_size=8192 |
| | RepartitionExec: partitioning=Hash([Column { name: "a", index: 0 }], 8), input_partitions=8 |
| | AggregateExec: mode=Partial, gby=[a@0 as a], aggr=[COUNT(UInt8(1))] |
| | RepartitionExec: partitioning=RoundRobinBatch(8), input_partitions=1 |
| | MemoryExec: partitions=1, partition_sizes=[1] |
| | |
+---------------+----------------------------------------------------------------------------------------------------------------------------+
To Reproduce
#[tokio::test]
async fn test_count_wildcard_on_where_scalar_subquery() -> Result<()> {
// you can find create_join_context() in datafusion/core/tests/dataframe.rs
let ctx = create_join_context()?;
ctx.sql("select a,b from t1 where (select count(*) from t2 where t1.a = t2.a)>0;")
.await?
.explain(false, false)?
.show()
.await?;
Ok(())
}
Expected behavior
No response
Additional context
No response
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working