You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@impala.apache.org by "Xuebin Su (Code Review)" <ge...@cloudera.org> on 2026/05/11 08:51:48 UTC
[Impala-ASF-CR] IMPALA-9059: Add UNPIVOT clause
Xuebin Su has uploaded a new patch set (#11). ( http://gerrit.cloudera.org:8080/23922 )
Change subject: IMPALA-9059: Add UNPIVOT clause
......................................................................
IMPALA-9059: Add UNPIVOT clause
This patch adds support for the UNPIVOT clause by creating a new
subclass of `TableRef` called `UnpivotTableRef`. The concepts and an
example are explained in `UnpivotTableRef.java`.
A new keyword `UNPIVOT` is added.
A new type of plan node and a new type of execution node called
`UnpivotNode` are added.
Two new notification methods are added in `TableRef.java` for
`UnpivotTableRef`:
- `notifySlotRefRegistered()` to register the SlotDescriptors in the
TupleDescriptor of the source TableRef and
- `notifySlotsMaterialized()` to mark the SlotDescriptors in the
TupleDescriptor of the source TableRef as materialized.
To support column masking, `Analyzer.resolveTableMask()` is moved and
renamed to `TableRef.applyTableMask()` so that `UnpivotTableRef` can
override it.
Limitations:
- IMPALA-14927: Different but compatible types are not supported in the
UNPIVOT clause
- IMPALA-14928: Multiple UNPIVOT clauses following the same path is not
supported
Testing:
- Added E2E tests in `test_unpivot_clause.py` and
`ranger_column_masking_and_row_filtering.test`.
- Added PlannerTest to ensure the predicates can be pushed down.
- Added AnalyzerTest.
Change-Id: I10e9d0a1bd70de02c7998afca274b895055d9b6a
---
M be/src/exec/CMakeLists.txt
M be/src/exec/exec-node.cc
A be/src/exec/unpivot-node.cc
A be/src/exec/unpivot-node.h
M common/thrift/PlanNodes.thrift
M fe/src/main/cup/sql-parser.cup
M fe/src/main/java/org/apache/impala/analysis/Analyzer.java
M fe/src/main/java/org/apache/impala/analysis/Expr.java
M fe/src/main/java/org/apache/impala/analysis/FromClause.java
M fe/src/main/java/org/apache/impala/analysis/InlineViewRef.java
M fe/src/main/java/org/apache/impala/analysis/QueryStmt.java
M fe/src/main/java/org/apache/impala/analysis/TableRef.java
M fe/src/main/java/org/apache/impala/analysis/TupleDescriptor.java
A fe/src/main/java/org/apache/impala/analysis/UnpivotTableRef.java
M fe/src/main/java/org/apache/impala/planner/DistributedPlanner.java
M fe/src/main/java/org/apache/impala/planner/SingleNodePlanner.java
A fe/src/main/java/org/apache/impala/planner/UnpivotNode.java
M fe/src/main/jflex/sql-scanner.flex
M fe/src/test/java/org/apache/impala/analysis/AnalyzeStmtsTest.java
M fe/src/test/java/org/apache/impala/planner/PlannerTest.java
A testdata/workloads/functional-planner/queries/PlannerTest/unpivot-clause.test
M testdata/workloads/functional-query/queries/QueryTest/ranger_column_masking_and_row_filtering.test
A testdata/workloads/functional-query/queries/QueryTest/unpivot-clause-large.test
A testdata/workloads/functional-query/queries/QueryTest/unpivot-clause.test
A tests/query_test/test_unpivot_clause.py
25 files changed, 1,682 insertions(+), 98 deletions(-)
git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/22/23922/11
--
To view, visit http://gerrit.cloudera.org:8080/23922
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I10e9d0a1bd70de02c7998afca274b895055d9b6a
Gerrit-Change-Number: 23922
Gerrit-PatchSet: 11
Gerrit-Owner: Xuebin Su <xs...@cloudera.com>
Gerrit-Reviewer: Daniel Vanko <dv...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Xuebin Su <xs...@cloudera.com>
Gerrit-Reviewer: Zoltan Borok-Nagy <bo...@cloudera.com>