You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@calcite.apache.org by GitBox <gi...@apache.org> on 2021/06/03 20:04:51 UTC
[GitHub] [calcite] a-rafay opened a new pull request #2423: [CALCITE-4636] Switch out of agg mode when constructing RelCollation …
a-rafay opened a new pull request #2423:
URL: https://github.com/apache/calcite/pull/2423
…for aggregate functions (Rafay)
--
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [calcite] amaliujia commented on a change in pull request #2423: [CALCITE-4636] Switch out of agg mode when constructing RelCollation …
Posted by GitBox <gi...@apache.org>.
amaliujia commented on a change in pull request #2423:
URL: https://github.com/apache/calcite/pull/2423#discussion_r647625094
##########
File path: core/src/main/java/org/apache/calcite/sql2rel/SqlToRelConverter.java
##########
@@ -5758,14 +5758,21 @@ private void translateAgg(SqlCall call, @Nullable SqlNode filter,
if (orderList == null || orderList.size() == 0) {
collation = RelCollations.EMPTY;
} else {
- collation = RelCollations.of(
- orderList.stream()
- .map(order ->
- bb.convertSortExpression(order,
- RelFieldCollation.Direction.ASCENDING,
- RelFieldCollation.NullDirection.UNSPECIFIED,
- this::sortToFieldCollation))
- .collect(Collectors.toList()));
+ try {
+ // switch out of agg mode
+ bb.agg = null;
Review comment:
Thanks for clarifying.
I can see now this is already an existing practice.
--
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [calcite] amaliujia commented on a change in pull request #2423: [CALCITE-4636] Switch out of agg mode when constructing RelCollation …
Posted by GitBox <gi...@apache.org>.
amaliujia commented on a change in pull request #2423:
URL: https://github.com/apache/calcite/pull/2423#discussion_r646821065
##########
File path: core/src/main/java/org/apache/calcite/sql2rel/SqlToRelConverter.java
##########
@@ -5758,14 +5758,21 @@ private void translateAgg(SqlCall call, @Nullable SqlNode filter,
if (orderList == null || orderList.size() == 0) {
collation = RelCollations.EMPTY;
} else {
- collation = RelCollations.of(
- orderList.stream()
- .map(order ->
- bb.convertSortExpression(order,
- RelFieldCollation.Direction.ASCENDING,
- RelFieldCollation.NullDirection.UNSPECIFIED,
- this::sortToFieldCollation))
- .collect(Collectors.toList()));
+ try {
+ // switch out of agg mode
+ bb.agg = null;
Review comment:
My question is why not keep the reference of bb.agg and then in the finally block, assign that reference back? (or is the bb.agg is always equal to this class?)
--
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [calcite] zinking commented on pull request #2423: [CALCITE-4636] Switch out of agg mode when constructing RelCollation …
Posted by GitBox <gi...@apache.org>.
zinking commented on pull request #2423:
URL: https://github.com/apache/calcite/pull/2423#issuecomment-855546787
LGTM. does it only generates impact on your hypothetical query? or other queries are wrong as well ?
--
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [calcite] amaliujia closed pull request #2423: [CALCITE-4636] Switch out of agg mode when constructing RelCollation …
Posted by GitBox <gi...@apache.org>.
amaliujia closed pull request #2423:
URL: https://github.com/apache/calcite/pull/2423
--
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [calcite] a-rafay commented on a change in pull request #2423: [CALCITE-4636] Switch out of agg mode when constructing RelCollation …
Posted by GitBox <gi...@apache.org>.
a-rafay commented on a change in pull request #2423:
URL: https://github.com/apache/calcite/pull/2423#discussion_r646851010
##########
File path: core/src/main/java/org/apache/calcite/sql2rel/SqlToRelConverter.java
##########
@@ -5758,14 +5758,21 @@ private void translateAgg(SqlCall call, @Nullable SqlNode filter,
if (orderList == null || orderList.size() == 0) {
collation = RelCollations.EMPTY;
} else {
- collation = RelCollations.of(
- orderList.stream()
- .map(order ->
- bb.convertSortExpression(order,
- RelFieldCollation.Direction.ASCENDING,
- RelFieldCollation.NullDirection.UNSPECIFIED,
- this::sortToFieldCollation))
- .collect(Collectors.toList()));
+ try {
+ // switch out of agg mode
+ bb.agg = null;
Review comment:
See: https://github.com/apache/calcite/blob/master/core/src/main/java/org/apache/calcite/sql2rel/SqlToRelConverter.java#L5585
and:
https://github.com/apache/calcite/blob/master/core/src/main/java/org/apache/calcite/sql2rel/SqlToRelConverter.java#L5700
--
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [calcite] amaliujia commented on pull request #2423: [CALCITE-4636] Switch out of agg mode when constructing RelCollation …
Posted by GitBox <gi...@apache.org>.
amaliujia commented on pull request #2423:
URL: https://github.com/apache/calcite/pull/2423#issuecomment-860275633
Fixed via https://github.com/apache/calcite/commit/4e679f03771c89ffa463051b5698ead1d935748b
--
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [calcite] a-rafay commented on pull request #2423: [CALCITE-4636] Switch out of agg mode when constructing RelCollation …
Posted by GitBox <gi...@apache.org>.
a-rafay commented on pull request #2423:
URL: https://github.com/apache/calcite/pull/2423#issuecomment-858200503
@amaliujia any update on this?
--
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [calcite] a-rafay commented on pull request #2423: [CALCITE-4636] Switch out of agg mode when constructing RelCollation …
Posted by GitBox <gi...@apache.org>.
a-rafay commented on pull request #2423:
URL: https://github.com/apache/calcite/pull/2423#issuecomment-856097891
> LGTM. does it only generates impact on your hypothetical query? or other queries are wrong as well ?
@zinking the test case i fixed in this patch was wrong. So there might be other queries giving wrong results. I found one in my test case too, but it was very similar to the test case which i fixed.
--
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [calcite] a-rafay commented on a change in pull request #2423: [CALCITE-4636] Switch out of agg mode when constructing RelCollation …
Posted by GitBox <gi...@apache.org>.
a-rafay commented on a change in pull request #2423:
URL: https://github.com/apache/calcite/pull/2423#discussion_r646849314
##########
File path: core/src/main/java/org/apache/calcite/sql2rel/SqlToRelConverter.java
##########
@@ -5758,14 +5758,21 @@ private void translateAgg(SqlCall call, @Nullable SqlNode filter,
if (orderList == null || orderList.size() == 0) {
collation = RelCollations.EMPTY;
} else {
- collation = RelCollations.of(
- orderList.stream()
- .map(order ->
- bb.convertSortExpression(order,
- RelFieldCollation.Direction.ASCENDING,
- RelFieldCollation.NullDirection.UNSPECIFIED,
- this::sortToFieldCollation))
- .collect(Collectors.toList()));
+ try {
+ // switch out of agg mode
+ bb.agg = null;
Review comment:
It must be equal to this class. If you scroll at the top of this function, you'll see that. We also do something similar earlier in this function as well.
--
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org