You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hive.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2018/05/23 06:37:00 UTC

[jira] [Commented] (HIVE-19653) Incorrect predicate pushdown for groupby with grouping sets

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

ASF GitHub Bot commented on HIVE-19653:
---------------------------------------

GitHub user richox opened a pull request:

    https://github.com/apache/hive/pull/354

    HIVE-19653: Incorrect predicate pushdown for groupby with grouping sets

    

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/richox/hive master

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/hive/pull/354.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #354
    
----
commit ae60a4802d0f9301d737a247ba85ed4cc56d34a7
Author: zhanglirich <zh...@...>
Date:   2018-05-22T13:41:35Z

    HIVE-19653: Incorrect predicate pushdown for groupby with grouping sets

----


> Incorrect predicate pushdown for groupby with grouping sets
> -----------------------------------------------------------
>
>                 Key: HIVE-19653
>                 URL: https://issues.apache.org/jira/browse/HIVE-19653
>             Project: Hive
>          Issue Type: Bug
>          Components: Logical Optimizer
>    Affects Versions: 3.1.0
>            Reporter: Zhang Li
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 3.1.0
>
>         Attachments: HIVE-19653.patch
>
>
> Consider the following query:
> {code:java}
> CREATE TABLE T1(a STRING, b STRING, s BIGINT);
> INSERT OVERWRITE TABLE T1 VALUES ('aaaa', 'bbbb', 123456);
> SELECT * FROM (
> SELECT a, b, sum(s)
> FROM T1
> GROUP BY a, b GROUPING SETS ((), (a), (b), (a, b))
> ) t WHERE a IS NOT NULL;
> {code}
> When hive.optimize.ppd is enabled (and hive.cbo.enable=false), the query will output:
> {code:java}
> NULL	NULL	123456
> NULL	bbbb	123456
> aaaa	NULL	123456
> aaaa	bbbb	123456
> {code}
> We can see the predicate "a IS NOT NULL" takes no effect, which is incorrect.
> When performing PPD optimization for a GBY operator, we should make sure all grouping sets contains the processing expr before pushdown. otherwise the expr value after GBY is changed and the result is wrong.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)