avamingli opened a new issue, #1376:
URL: https://github.com/apache/cloudberry/issues/1376
### Apache Cloudberry version
main
### What happened
as titile
### What you think should happen instead
_No response_
### How to reproduce
```sql
create table t1(a int, b int);
create table t2 like(t1);
set gp_cte_sharing = on;
explain(locus, costs off) with x as (select a, count(*) as b from t1 group
by a union all select a, count(*) as b from t2 group by a) select count(*) from
x a join x b on a.a = b.b;
QUERY PLAN
------------------------------------------------------------------------
Finalize Aggregate
Locus: Entry
-> Gather Motion 3:1 (slice1; segments: 3)
Locus: Entry
-> Partial Aggregate
Locus: Hashed
-> Hash Join
Locus: Hashed
Hash Cond: (b.b = a.a)
-> Redistribute Motion 3:3 (slice2; segments: 3)
Locus: Hashed
Hash Key: b.b
-> Subquery Scan on b
Locus: Strewn
-> Shared Scan (share slice:id 2:0)
Locus: NULL
-> Hash
Locus: Hashed
-> Subquery Scan on a
Locus: Hashed
-> Shared Scan (share slice:id 1:0)
Locus: NULL
-> Append
Locus: Hashed
-> HashAggregate
Locus: Hashed
Group Key: t1.a
-> Seq Scan on t1
Locus: Hashed
-> HashAggregate
Locus: Hashed
Group Key: t2.a
-> Seq Scan on t2
Locus: Hashed
Optimizer: Postgres query optimizer
(35 rows)
```
### Operating System
all
### Anything else
_No response_
### Are you willing to submit PR?
- [x] Yes, I am willing to submit a PR!
### Code of Conduct
- [x] I agree to follow this project's [Code of
Conduct](https://github.com/apache/cloudberry/blob/main/CODE_OF_CONDUCT.md).
--
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]