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 2021/12/14 10:48:00 UTC

[jira] [Work logged] (HIVE-25805) Wrong result when rebuilding MV with count(col) incrementally

     [ https://issues.apache.org/jira/browse/HIVE-25805?focusedWorklogId=695631&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-695631 ]

ASF GitHub Bot logged work on HIVE-25805:
-----------------------------------------

                Author: ASF GitHub Bot
            Created on: 14/Dec/21 10:47
            Start Date: 14/Dec/21 10:47
    Worklog Time Spent: 10m 
      Work Description: kasakrisz opened a new pull request #2872:
URL: https://github.com/apache/hive/pull/2872


   <!--
   Thanks for sending a pull request!  Here are some tips for you:
     1. If this is your first time, please read our contributor guidelines: https://cwiki.apache.org/confluence/display/Hive/HowToContribute
     2. Ensure that you have created an issue on the Hive project JIRA: https://issues.apache.org/jira/projects/HIVE/summary
     3. Ensure you have added or run the appropriate tests for your PR: 
     4. If the PR is unfinished, add '[WIP]' in your PR title, e.g., '[WIP]HIVE-XXXXX:  Your PR title ...'.
     5. Be sure to keep the PR description updated to reflect all changes.
     6. Please write your PR title to summarize what this PR proposes.
     7. If possible, provide a concise example to reproduce the issue for a faster review.
   
   -->
   
   ### What changes were proposed in this pull request?
   When generating incremental rebuild plan for MVs having aggregate and delete operations in any source tables check if the view definition contains any `count` aggregate function which has argument. If it has add expression to check if that argument is `null` or not. 
   
   ### Why are the changes needed?
   Records with `null` values should not be counted in the final aggregation.
   
   ### Does this PR introduce _any_ user-facing change?
   Yes. This patch fixes a data correctness issue.
   
   ### How was this patch tested?
   ```
   mvn test -Dtest.output.overwrite -DskipSparkTests -Dtest=TestMiniLlapLocalCliDriver -Dqfile=materialized_view_create_rewrite_6.q -pl itests/qtest -Pitests
   ```


-- 
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: gitbox-unsubscribe@hive.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Issue Time Tracking
-------------------

            Worklog Id:     (was: 695631)
    Remaining Estimate: 0h
            Time Spent: 10m

> Wrong result when rebuilding MV with count(col) incrementally
> -------------------------------------------------------------
>
>                 Key: HIVE-25805
>                 URL: https://issues.apache.org/jira/browse/HIVE-25805
>             Project: Hive
>          Issue Type: Bug
>          Components: CBO, Materialized views
>            Reporter: Krisztian Kasa
>            Assignee: Krisztian Kasa
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> {code:java}
> create table t1(a char(15), b int) stored as orc TBLPROPERTIES ('transactional'='true');
> insert into t1(a, b) values ('old', 1);
> create materialized view mat1 stored as orc TBLPROPERTIES ('transactional'='true') as
> select t1.a, count(t1.b), count(*) from t1 group by t1.a;
> delete from t1 where b = 1;
> insert into t1(a,b) values
> ('new', null);
> alter materialized view mat1 rebuild;
> select * from mat1;
> {code}
> returns
> {code:java}
> new            	1	1
> {code}
> but, should be
> {code:java}
> new            	0	1
> {code}



--
This message was sent by Atlassian Jira
(v8.20.1#820001)