#28518·presto

Flaky test: TestHistoryBasedStatsTracking.testJoinWithProbeNull fails sometimes in CI

Author: yingsu00Created Sep 19, 2026Updated Sep 19, 2026
Labelsiceberg

What happens

The test TestHistoryBasedStatsTracking.testJoinWithProbeNull fails in CI from time to time. It does not fail on every run, and the same code can pass when the job is run again.

It fails in this job:

test (17, :presto-tests -P presto-tests-execution-memory)

Failed pipelines

PR #28506 only bumps a dependency version in presto-druid. It does not touch the planner or statistics. So the failure does not come from the change being tested.

Out of 16 open PRs I looked at on 18 Sep 2026, this job was green on 14 and red on these 2.

Error

[ERROR] TestHistoryBasedStatsTracking.testJoinWithProbeNull:509 Plan does not match, expected [

- anyTree
    - node(JoinNode)
        expectedOutputRowCount(2204.0)
        expectedJoinBuildKeyCount(1500.0) expectedNullJoinBuildKeyCount(0.0) expectedNullJoinProbeKeyCount(1.0)
...

What the failure looks like

The test runs the query once so its statistics get recorded, then plans the query again and checks that the recorded numbers are used.

In the failing runs, the join node in the second plan has no estimates at all:

- InnerJoin[PlanNodeId 15][("custkey_23" = "custkey_31")][$hashvalue, $hashvalue_46] => [totalprice_22:double, name:varchar(25)]
    - LocalExchange[PlanNodeId 884][ROUND_ROBIN] () => [...]

In a local run, the same line carries them:

- InnerJoin[PlanNodeId 15][("custkey_23" = "custkey_31")][$hashvalue, $hashvalue_46] => [totalprice_22:double, name:varchar(25)]
        Estimates: {source: HistoryBasedSourceInfo, rows: 2,204 (68.88kB), cpu: ?, memory: ?, network: ?, hashtable[size: 1,500.00, nulls 0.00]}

So in the failing runs the recorded statistics were not used for the join node. The numbers the test expects look correct, and other nodes in the failing plan do show HistoryBasedSourceInfo, so it looks like the history for the join node was not there yet, or was not matched, on the second plan.

How to reproduce

I could not make it fail locally. This passes for me:

./mvnw -pl presto-tests -am test -Dtest='TestHistoryBasedStatsTracking#testJoinWithProbeNull'

Only CI has shown the failure so far.

Related

#22204 reports another test in the same class (testHistoryBasedStatsCalculator) as flaky. The cause may be the same.