xiangfu0 opened a new pull request, #17168:
URL: https://github.com/apache/pinot/pull/17168
#### What's new
- Introduce logical and physical support for UNNEST (aka FLATTEN) in the
multi-stage engine:
- ANSI-style `CROSS JOIN UNNEST(expr) [AS alias(column)]`
- Each element in a multi-value (MV) column emits a new row
#### SQL surface
- Example:
- `SELECT id, u.elem FROM T CROSS JOIN UNNEST(tags) AS u(elem);`
- `SELECT COUNT(*) FROM T CROSS JOIN UNNEST(longArrayCol) AS u(elem);`
#### Planner changes (pinot-query-planner, pinot-common)
- Add `UnnestNode` plan node and full SerDe
- `plan.proto`: new `UnnestNode` message
- `PlanNodeSerializer`/`PlanNodeDeserializer`: read/write `UnnestNode`
- `PlanNodeVisitor`: new `visitUnnest` API and coverage in all relevant
visitors
- Recognize Calcite UNNEST patterns
- `RelToPlanNodeConverter`:
- Handle `Uncollect` (standard UNNEST)
- Handle `LogicalCorrelate` pattern (CROSS JOIN UNNEST cases)
- Extract array expression + output element alias from Calcite row type
- Ensure mutable inputs list when constructing `UnnestNode` (fix for
downstream visitors)
- Wire into planning/dispatch/explain
- `PlanFragmenter`, `SubPlanFragmenter`, `DispatchablePlanVisitor`,
`PlanNodeSorter`, `ExplainNodeSimplifier`, `PlanNodeMerger`,
`ArrayToMvValidationVisitor`, `PhysicalExplainPlanVisitor` updated to handle
`UnnestNode`
#### Runtime changes (pinot-query-runtime)
- New `UnnestOperator`
- Expands array/list values per input row to multiple output rows
- Appends element column (name via `columnAlias`)
- Proper EOS/error propagation
- Stats integrated under `MultiStageOperator.Type.UNNEST`
- Operator wiring
- `PlanNodeToOpChain`: `UnnestNode`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]