cloudberry icon indicating copy to clipboard operation
cloudberry copied to clipboard

[Bug] There is a problem with the distribution strategy of the orca unionall operator.

Open Light-City opened this issue 2 years ago • 2 comments

Cloudberry Database version

master

What happened

The orca optimizer currently returns the ANY policy for the first child of a unionall-like node, which will result in Gather Motion for the downstream chi ldren and a 1:n Redistribution for the upstream.

for example:
    ->  Redistribute Motion 1:3  (slice2)
       ->  Append  (cost=0.00..863.91 rows=18001 width=12)
          ->  Finalize Vec Aggregate
            ->  Gather Motion 3:1  (slice3; segments: 3)
              ...
       ->  Gather Motion 3:1  (slice4; segments: 3)
          ->  HashAggregate

What you think should happen instead

remove child gather motion and upstream redis motion, just add 1:n to first child.

How to reproduce

tpcds 167 query

Operating System

centos7

Anything else

No response

Are you willing to submit PR?

  • [X] Yes, I am willing to submit a PR!

Code of Conduct

Light-City avatar Nov 02 '23 02:11 Light-City

Hey, @Light-City welcome!🎊 Thanks for taking the time to point this out.🙌

github-actions[bot] avatar Nov 02 '23 02:11 github-actions[bot]

gpdb also fix this change, https://github.com/greenplum-db/gpdb/commit/0cd056a0a3d3c30a1d6d4479e67802b6673118c7

Light-City avatar Nov 02 '23 02:11 Light-City