Repository navigation
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #19771 +/- ##
============================================
+ Coverage 68.40% 68.46% +0.06%
Complexity 1470 1470
============================================
Files 3521 3522 +1
Lines 229091 229204 +113
Branches 36346 36377 +31
============================================
+ Hits 156707 156924 +217
+ Misses 60104 60001 -103
+ Partials 12280 12279 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Jackie-Jiang
approved these changes
Oct 6, 2026
yashmayya
force-pushed
the
explain-plan-unnest
branch
2 times, most recently
from
October 7, 2026 01:40
63e716a to
0db2d70
Compare
yashmayya
force-pushed
the
explain-plan-unnest
branch
from
October 7, 2026 04:15
0db2d70 to
f580422
Compare
gortiz
approved these changes
Oct 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR flow
Fix for CROSS JOIN UNNEST EXPLAIN: build Correlate plan when input columns are passed through.
AI-generated · Green: added · Yellow: modified · Red: removed · Gray: existing
Diff evidence
The bug
With
explainAskingServers(or the broker configpinot.query.multistage.explain.include.segment.plan), the broker gets the plan of each leaf stage from the servers. ThenPlanNodeToRelConverterconverts the plan nodes back to Calcite nodes.visitUnnestconverts anUnnestNodeto anUncollectover aProjectof the arrays. The output of thisUncollecthas only the element (and ordinality) columns. But for CROSS JOIN UNNEST, theUnnestNodeoutput has the input columns first, then the element columns. So a parent node in the leaf stage cannot find its input fields, and EXPLAIN shows it asUnknownAggregateorUnknownProject.For example:
EXPLAIN shows the leaf stage as:
The broker logs
IllegalArgumentException: field ordinal [2] out of range; input fields are: [DivAirports]. These queries have the same problem: GROUP BY only the element column, WITH ORDINALITY, ROLLUP,SELECT Carrier, u.a ... LIMIT 10, and queries withunnestColumnPruning=true.The fix
If the
UnnestNodeoutput has input columns,visitUnnestnow builds the same shape as the logical plan. This shape is aLogicalCorrelateof the input with anUncollectthat reads the arrays through the correlation variable. If the planner pruned some input columns (unnestColumnPruning), aProjectkeeps only the remaining input columns. A plain UNNEST without input columns does not change.Only the EXPLAIN output changes. Query execution does not use this conversion.
Testing
PlanNodeToRelConverterTest.testAggregateOverUnnestconverts an aggregate over CROSS JOIN UNNEST.testProjectOverPrunedUnnestconverts a project over a pruned UNNEST WITH ORDINALITY. Without this change, they fail withUnknownAggregateandUnknownProject.Unknownnode. After it, none do, and the leaf stages match the logical plan shape. For the query above:pinot-query-plannertests pass.spotless,checkstyleandlicenseare clean.