[ 
https://issues.apache.org/jira/browse/IMPALA-2083?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18081106#comment-18081106
 ] 

ASF subversion and git services commented on IMPALA-2083:
---------------------------------------------------------

Commit 56be75218a7dd11a45ad231208a3972cb4b479ac in impala's branch 
refs/heads/master from Xuebin Su
[ https://gitbox.apache.org/repos/asf?p=impala.git;h=56be75218 ]

IMPALA-2083: Add PIVOT clause

This patch adds support for the PIVOT clause by adding a new subclass
of `TableRef` called `PivotTableRef`. The concepts and the examples are
explained in `PivotTableRef.java`.

The changes are mostly in the frontend:
- A new keyword `PIVOT` is added.
- In the parsing phase, a PIVOT clause will be parsed into a
  `PivotTableRef`.
- Then, in the analysis phase, the `PivotTableRef` will be rewritten to
  an `InlineViewRef` to a nested subquery, in which
  - First, the source table will be aggregated with the aggregate
    expressions specified in the PIVOT clause;
  - Then, each aggregated column will be split into multiple columns
    with the `aggif()` function, one for each value in the PIVOT clause.
No new plan node or new execution node is added.

Since it is now possible that the predicate in the `aggif()` function
references a nullable slot, this patch removes the restriction that the
predicate must not be NULL.

Limitations:
- Multiple header columns in the PIVOT clause is not supported.
- Specifying a nested field as the header column is not supported.
- Specifying constant expressions other than literals in the header
  value list is not supported.
- Using the PIVOT clause in statements other than SELECT is not
  supported.

Testing:
- Added E2E tests in test_pivot_clause.py
- Added FE tests to ensure that predicates can be pushed down to the
  SCAN nodes.

Change-Id: Ib799b772be18d2a3db8983b24e1068e7dfdf1ca9
Reviewed-on: http://gerrit.cloudera.org:8080/24105
Reviewed-by: Quanlong Huang <[email protected]>
Tested-by: Impala Public Jenkins <[email protected]>


> Add PIVOT operator
> ------------------
>
>                 Key: IMPALA-2083
>                 URL: https://issues.apache.org/jira/browse/IMPALA-2083
>             Project: IMPALA
>          Issue Type: New Feature
>          Components: Backend
>    Affects Versions: Impala 2.2
>            Reporter: Mala Chikka Kempanna
>            Assignee: Xuebin Su
>            Priority: Critical
>              Labels: sql-language
>
> Reference:
> https://docs.microsoft.com/en-us/sql/t-sql/queries/from-using-pivot-and-unpivot
> https://docs.oracle.com/cd/E11882_01/server.112/e25554/analysis.htm#DWHSG8732



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to