You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hive.apache.org by "Vineet Garg (JIRA)" <ji...@apache.org> on 2018/09/17 00:14:00 UTC
[jira] [Commented] (HIVE-17041) Aggregate elimination with UNIQUE
and NOT NULL column
[ https://issues.apache.org/jira/browse/HIVE-17041?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16616956#comment-16616956 ]
Vineet Garg commented on HIVE-17041:
------------------------------------
Calcite uses RelOptTable's isKey api to determine the uniqueness. The implementation for this in RelOptHiveTable doesn't take into account the nullability of UNIQUE constraint, as a result calcite can end up removing UNIQUE constraint without NOT NULL column.
We should probably update isKey or generateKeys to take into account only PRIMARY KEYS and UNIQUE + NOT NULL columns. [~jcamachorodriguez] suggestions?
> Aggregate elimination with UNIQUE and NOT NULL column
> -----------------------------------------------------
>
> Key: HIVE-17041
> URL: https://issues.apache.org/jira/browse/HIVE-17041
> Project: Hive
> Issue Type: Sub-task
> Components: Logical Optimizer
> Affects Versions: 3.0.0
> Reporter: Jesus Camacho Rodriguez
> Assignee: Vineet Garg
> Priority: Major
> Attachments: HIVE-17041.1.patch
>
>
> If columns are part of a GROUP BY expression and they are UNIQUE and do not accept NULL values, i.e. PK or UK+NOTNULL, the _Aggregate_ operator can be transformed into a Project operator, as each row will end up in a different group.
> For instance, given that _pk_ is the PRIMARY KEY for the table, the GROUP BY could be removed from grouping columns for following query:
> {code:sql}
> SELECT pk, value1
> FROM table_1
> GROUP BY value1, pk, value2;
> {code}
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)