Skip to content

sql: vectorized stats collectors can finish prematurely #56928

@RaduBerinde

Description

@RaduBerinde

I am working on aggregating row counts for EXPLAIN ANALYZE (PLAN) and ran into some flaky plans. I traced it down to some vectorized stat collectors being finished (i.e. OutputStats() being called) early.

I managed to figure out a repro using this patch (repro instructions in there too).

In an instance of the repro, we have this plan.

According to various printf sprinkled around the code, I saw that the collector for TableReader/2 is called before we even emit a batch from that processor. The issue is that the collectors for TableReader/2 and HashJoiner/6 are in the same finishVectorizedStatsCollectors list and will finish together. In this case, it's possible that TableReader/3 finished without producing any rows that go to HashJoiner/6 which caused that processor to finish execution.

Metadata

Metadata

Assignees

Labels

C-bugCode not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions