You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hawq.apache.org by "zhenglin tao (JIRA)" <ji...@apache.org> on 2016/02/21 13:53:18 UTC

[jira] [Comment Edited] (HAWQ-427) Wrong results in mdqa+rollup

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

zhenglin tao edited comment on HAWQ-427 at 2/21/16 12:52 PM:
-------------------------------------------------------------

In mdqa join motion, dqa agg TargetEntry appears as the Hash Key of Redistribute Motion for HashJoin, which is wrong. The wrong plan is simplified as below:
{code}
->  Hash Join 
    Hash Cond: NOT dqa_coplan_1.vn IS DISTINCT FROM dqa_coplan_2.vn
    ->  Redistribute Motion 2:2
       Hash Key: dqa_coplan_1.vn,  dqa_coplan_1.max
    ->  Hash  
       ->  Redistribute Motion 2:2
            Hash Key: dqa_coplan_2.vn, dqa_coplan_2.max
{code}
Here dqa_coplan_1.max and dqa_coplan_2.max should not be the key.

Root cause is that tleSortGroupRef in SortClause for Rollup is zero, while ressortgroupref in TargetEntry for dqa agg is also zero. In get_sortgrouplist_exprs, we tried to build the referenced targetlist for SortGroupClause. However we don't consider they are both zero when checking if tleSortGroupRef equals to ressortgroupref. 


was (Author: ztao1987):
In mdqa join motion, dqa agg TargetEntry appears as the Hash Key of Redistribute Motion for HashJoin, which is wrong. The wrong plan is simplified as below:
->  Hash Join 
    Hash Cond: NOT dqa_coplan_1.vn IS DISTINCT FROM dqa_coplan_2.vn
    ->  Redistribute Motion 2:2
       Hash Key: dqa_coplan_1.vn,  dqa_coplan_1.max
    ->  Hash  
       ->  Redistribute Motion 2:2
            Hash Key: dqa_coplan_2.vn, dqa_coplan_2.max
Here dqa_coplan_1.max and dqa_coplan_2.max should not be the key.

Root cause is that tleSortGroupRef in SortClause for Rollup is zero, while ressortgroupref in TargetEntry for dqa agg is also zero. In get_sortgrouplist_exprs, we tried to build the referenced targetlist for SortGroupClause. However we don't consider they are both zero when checking if tleSortGroupRef equals to ressortgroupref. 

> Wrong results in mdqa+rollup
> ----------------------------
>
>                 Key: HAWQ-427
>                 URL: https://issues.apache.org/jira/browse/HAWQ-427
>             Project: Apache HAWQ
>          Issue Type: Bug
>          Components: Core
>            Reporter: zhenglin tao
>            Assignee: Lei Chang
>
> Reproduce steps:
> create table sale
> (
> cn int not null,
> vn int not null,
> pn int not null,
> dt date not null,
> qty int not null,
> prc float not null
> ) WITH (appendonly=true, orientation = parquet) distributed randomly;
> insert into sale values ( 4, 40, 800, '1401-6-1', 1, 1);
> select MAX(DISTINCT sale.vn),MAX(DISTINCT sale.prc) FROM sale GROUP BY (sale.prc),ROLLUP(sale.prc);
> No results is returned.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)