[jira] [Commented] (CALCITE-2249) AggregateJoinTransposeRule generates inequivalent nodes if Aggregate relNode contains distinct aggregate function.

2018-04-20 Thread Julian Hyde (JIRA)

[ 
https://issues.apache.org/jira/browse/CALCITE-2249?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16446292#comment-16446292
 ] 

Julian Hyde commented on CALCITE-2249:
--

[~jinyu.zj], A few review comments:
* You have removed one method's javadoc comment for no reason.
* You have re-ordered the imports (I suspect that checkstyle will fail).
* Since your test calls checkUnchanged() you don't need the "planAfter" 
resource.

I recommend that you do 'git diff' before you submit a PR; it will catch issues 
like 1 and 2 above.

> AggregateJoinTransposeRule generates inequivalent nodes if Aggregate relNode 
> contains distinct aggregate function.
> --
>
> Key: CALCITE-2249
> URL: https://issues.apache.org/jira/browse/CALCITE-2249
> Project: Calcite
>  Issue Type: Bug
>  Components: core
>Reporter: jingzhang
>Assignee: Julian Hyde
>Priority: Major
>
> AggregateJoinTransposeRule generates inequivalent nodes if Aggregate relNode 
> contains distinct aggregate function.
> T1
> ||a (String)||b (int)||
> |A|1|
> |A|2|
> |B|2|
> |C|3|
>  
> T2
> ||c(int)||
> |1|
> |1|
> |2|
> For the following sql, 
> {code:java}
> select count (distinct a) from t1, t2 where t1.b = t2.c  
> {code}
> Aggregate would generate following node tree, which is inequivalent with 
> original node tree.
> {code:java}
> LogicalAggregate(group=[{}], EXPR$0=[$SUM0($4)])
> +- LogicalProject(b=[$0], EXPR$0=[$1], c=[$2], $f1=[$3], $f4=[*($1, $3)])
> +- LogicalJoin(condition=[=($0, $2)], joinType=[inner])
> :- LogicalAggregate(group=[\{1}], EXPR$0=[COUNT(DISTINCT $0)])
> : +- LogicalTableScan(table=[[t1]])
> +- LogicalAggregate(group=[\{0}], agg#0=[COUNT()])
> +- LogicalTableScan(table=[[t2]])
> {code}
> Based on the converted plan, result is 4; while the correct answer is 2.



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


[jira] [Commented] (CALCITE-2249) AggregateJoinTransposeRule generates inequivalent nodes if Aggregate relNode contains distinct aggregate function.

2018-04-11 Thread jingzhang (JIRA)

[ 
https://issues.apache.org/jira/browse/CALCITE-2249?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16433566#comment-16433566
 ] 

jingzhang commented on CALCITE-2249:


Cool. I submit a pr [https://github.com/apache/calcite/pull/661.] Please have a 
look at it.

> AggregateJoinTransposeRule generates inequivalent nodes if Aggregate relNode 
> contains distinct aggregate function.
> --
>
> Key: CALCITE-2249
> URL: https://issues.apache.org/jira/browse/CALCITE-2249
> Project: Calcite
>  Issue Type: Bug
>  Components: core
>Reporter: jingzhang
>Assignee: Julian Hyde
>Priority: Major
>
> AggregateJoinTransposeRule generates inequivalent nodes if Aggregate relNode 
> contains distinct aggregate function.
> T1
> ||a (String)||b (int)||
> |A|1|
> |A|2|
> |B|2|
> |C|3|
>  
> T2
> ||c(int)||
> |1|
> |1|
> |2|
> For the following sql, 
> {code:java}
> select count (distinct a) from t1, t2 where t1.b = t2.c  
> {code}
> Aggregate would generate following node tree, which is inequivalent with 
> original node tree.
> {code:java}
> LogicalAggregate(group=[{}], EXPR$0=[$SUM0($4)])
> +- LogicalProject(b=[$0], EXPR$0=[$1], c=[$2], $f1=[$3], $f4=[*($1, $3)])
> +- LogicalJoin(condition=[=($0, $2)], joinType=[inner])
> :- LogicalAggregate(group=[\{1}], EXPR$0=[COUNT(DISTINCT $0)])
> : +- LogicalTableScan(table=[[t1]])
> +- LogicalAggregate(group=[\{0}], agg#0=[COUNT()])
> +- LogicalTableScan(table=[[t2]])
> {code}
> Based on the converted plan, result is 4; while the correct answer is 2.



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


[jira] [Commented] (CALCITE-2249) AggregateJoinTransposeRule generates inequivalent nodes if Aggregate relNode contains distinct aggregate function.

2018-04-11 Thread Julian Hyde (JIRA)

[ 
https://issues.apache.org/jira/browse/CALCITE-2249?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16433544#comment-16433544
 ] 

Julian Hyde commented on CALCITE-2249:
--

Yes, and use a predicate (similar to Aggregate.IS_SIMPLE) to bail out before 
the rule is even matched.

> AggregateJoinTransposeRule generates inequivalent nodes if Aggregate relNode 
> contains distinct aggregate function.
> --
>
> Key: CALCITE-2249
> URL: https://issues.apache.org/jira/browse/CALCITE-2249
> Project: Calcite
>  Issue Type: Bug
>  Components: core
>Reporter: jingzhang
>Assignee: Julian Hyde
>Priority: Major
>
> AggregateJoinTransposeRule generates inequivalent nodes if Aggregate relNode 
> contains distinct aggregate function.
> T1
> ||a (String)||b (int)||
> |A|1|
> |A|2|
> |B|2|
> |C|3|
>  
> T2
> ||c(int)||
> |1|
> |1|
> |2|
> For the following sql, 
> {code:java}
> select count (distinct a) from t1, t2 where t1.b = t2.c  
> {code}
> Aggregate would generate following node tree, which is inequivalent with 
> original node tree.
> {code:java}
> LogicalAggregate(group=[{}], EXPR$0=[$SUM0($4)])
> +- LogicalProject(b=[$0], EXPR$0=[$1], c=[$2], $f1=[$3], $f4=[*($1, $3)])
> +- LogicalJoin(condition=[=($0, $2)], joinType=[inner])
> :- LogicalAggregate(group=[\{1}], EXPR$0=[COUNT(DISTINCT $0)])
> : +- LogicalTableScan(table=[[t1]])
> +- LogicalAggregate(group=[\{0}], agg#0=[COUNT()])
> +- LogicalTableScan(table=[[t2]])
> {code}
> Based on the converted plan, result is 4; while the correct answer is 2.



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


[jira] [Commented] (CALCITE-2249) AggregateJoinTransposeRule generates inequivalent nodes if Aggregate relNode contains distinct aggregate function.

2018-04-11 Thread Haisheng Yuan (JIRA)

[ 
https://issues.apache.org/jira/browse/CALCITE-2249?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16433540#comment-16433540
 ] 

Haisheng Yuan commented on CALCITE-2249:


We can bail out for distinct aggregation.

> AggregateJoinTransposeRule generates inequivalent nodes if Aggregate relNode 
> contains distinct aggregate function.
> --
>
> Key: CALCITE-2249
> URL: https://issues.apache.org/jira/browse/CALCITE-2249
> Project: Calcite
>  Issue Type: Bug
>  Components: core
>Reporter: jingzhang
>Assignee: Julian Hyde
>Priority: Major
>
> AggregateJoinTransposeRule generates inequivalent nodes if Aggregate relNode 
> contains distinct aggregate function.
> T1
> ||a (String)||b (int)||
> |A|1|
> |A|2|
> |B|2|
> |C|3|
>  
> T2
> ||c(int)||
> |1|
> |1|
> |2|
> For the following sql, 
> {code:java}
> select count (distinct a) from t1, t2 where t1.b = t2.c  
> {code}
> Aggregate would generate following node tree, which is inequivalent with 
> original node tree.
> {code:java}
> LogicalAggregate(group=[{}], EXPR$0=[$SUM0($4)])
> +- LogicalProject(b=[$0], EXPR$0=[$1], c=[$2], $f1=[$3], $f4=[*($1, $3)])
> +- LogicalJoin(condition=[=($0, $2)], joinType=[inner])
> :- LogicalAggregate(group=[\{1}], EXPR$0=[COUNT(DISTINCT $0)])
> : +- LogicalTableScan(table=[[t1]])
> +- LogicalAggregate(group=[\{0}], agg#0=[COUNT()])
> +- LogicalTableScan(table=[[t2]])
> {code}
> Based on the converted plan, result is 4; while the correct answer is 2.



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