apache / cloudberry

One advanced and mature open-source MPP (Massively Parallel Processing) database. Open source alternative to Greenplum Database.
https://cloudberry.apache.org
Apache License 2.0
418 stars 104 forks source link

Fix explain analyze printing "never executed" uncorrectly #672

Closed fanfuxiaoran closed 1 month ago

fanfuxiaoran commented 1 month ago

explain analyze insert into test select i from generate_series(0,100) as i;

Insert on test (never executed) -> Result (actual time=0.021..0.046 rows=38 loops=1) -> Result (actual time=0.021..0.041 rows=38 loops=1) -> Function Scan on generate_series (actual time=0.018..0.026 rows=101 loops=1)

As shown above, insert node is considered never executed. Actually, it has been executed. This is due to the collected nloops of that node is wrong. When the nloops in the instrument is 0, the plan node will be considered as 'never executed'.

In some plan nodes, the rows returned is 0, but the nloops is not, fix related code in gp_explain.c

fix #ISSUE_Number


Change logs

Describe your change clearly, including what problem is being solved or what feature is being added.

If it has some breaking backward or forward compatibility, please clary.

Why are the changes needed?

Describe why the changes are necessary.

Does this PR introduce any user-facing change?

If yes, please clarify the previous behavior and the change this PR proposes.

How was this patch tested?

Please detail how the changes were tested, including manual tests and any relevant unit or integration tests.

Contributor's Checklist

Here are some reminders and checklists before/when submitting your pull request, please check them:

my-ship-it commented 1 month ago

Big diffs between ans files. We need to fixing pax/vec cases after cherry-picking to Lightning. @gfphoenix78 @Light-City

my-ship-it commented 1 month ago

Please fix CI failures

fanfuxiaoran commented 1 month ago

Please fix CI failures

Looks like the failures are related to ao vacuum, will fix them.

fanfuxiaoran commented 1 month ago

Please fix CI failures

Have tested it locally and rerun it on the ci, cannot reproduce the failed case.