You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@calcite.apache.org by "rubenada (via GitHub)" <gi...@apache.org> on 2024/07/20 08:48:52 UTC
[PR] [CALCITE-6488] Ensure collations created by RelCollations are canonized once [calcite]
rubenada opened a new pull request, #3874:
URL: https://github.com/apache/calcite/pull/3874
More info: CALCITE-6488
--
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: commits-unsubscribe@calcite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [CALCITE-6488] Ensure collations created by RelCollations are canonized once [calcite]
Posted by "rubenada (via GitHub)" <gi...@apache.org>.
rubenada merged PR #3874:
URL: https://github.com/apache/calcite/pull/3874
--
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: commits-unsubscribe@calcite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [CALCITE-6488] Ensure collations created by RelCollations are canonized once [calcite]
Posted by "caicancai (via GitHub)" <gi...@apache.org>.
caicancai commented on code in PR #3874:
URL: https://github.com/apache/calcite/pull/3874#discussion_r1685336405
##########
core/src/main/java/org/apache/calcite/rel/RelCollations.java:
##########
@@ -270,7 +270,7 @@ public static RelCollation shift(RelCollation collation, int offset) {
for (RelFieldCollation fc : collation.getFieldCollations()) {
fieldCollations.add(fc.shift(offset));
}
- return new RelCollationImpl(fieldCollations.build());
+ return RelCollationTraitDef.INSTANCE.canonize(new RelCollationImpl(fieldCollations.build()));
Review Comment:
Looks good, maybe some JavaDoc could be added here
--
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: commits-unsubscribe@calcite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [CALCITE-6488] Ensure collations created by RelCollations are canonized once [calcite]
Posted by "sonarcloud[bot] (via GitHub)" <gi...@apache.org>.
sonarcloud[bot] commented on PR #3874:
URL: https://github.com/apache/calcite/pull/3874#issuecomment-2241056384
## [](https://sonarcloud.io/dashboard?id=apache_calcite&pullRequest=3874) **Quality Gate passed**
Issues
 [0 New issues](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=3874&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0 Accepted issues](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=3874&issueStatuses=ACCEPTED)
Measures
 [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_calcite&pullRequest=3874&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [100.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_calcite&pullRequest=3874&metric=new_coverage&view=list)
 [0.0% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_calcite&pullRequest=3874&metric=new_duplicated_lines_density&view=list)
[See analysis details on SonarCloud](https://sonarcloud.io/dashboard?id=apache_calcite&pullRequest=3874)
--
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: commits-unsubscribe@calcite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [CALCITE-6488] Ensure collations created by RelCollations are canonized once [calcite]
Posted by "caicancai (via GitHub)" <gi...@apache.org>.
caicancai commented on code in PR #3874:
URL: https://github.com/apache/calcite/pull/3874#discussion_r1685456255
##########
core/src/main/java/org/apache/calcite/rel/rules/SortJoinCopyRule.java:
##########
@@ -96,9 +96,7 @@ public SortJoinCopyRule(Class<? extends Sort> sortClass,
if (leftFieldCollation.isEmpty()) {
newLeftInput = join.getLeft();
} else {
- final RelCollation leftCollation =
- RelCollationTraitDef.INSTANCE.canonize(
- RelCollations.of(leftFieldCollation));
+ final RelCollation leftCollation = RelCollations.of(leftFieldCollation);
Review Comment:
Yes, I also noticed this when I looked at the code
--
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: commits-unsubscribe@calcite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [CALCITE-6488] Ensure collations created by RelCollations are canonized once [calcite]
Posted by "caicancai (via GitHub)" <gi...@apache.org>.
caicancai commented on code in PR #3874:
URL: https://github.com/apache/calcite/pull/3874#discussion_r1685456255
##########
core/src/main/java/org/apache/calcite/rel/rules/SortJoinCopyRule.java:
##########
@@ -96,9 +96,7 @@ public SortJoinCopyRule(Class<? extends Sort> sortClass,
if (leftFieldCollation.isEmpty()) {
newLeftInput = join.getLeft();
} else {
- final RelCollation leftCollation =
- RelCollationTraitDef.INSTANCE.canonize(
- RelCollations.of(leftFieldCollation));
+ final RelCollation leftCollation = RelCollations.of(leftFieldCollation);
Review Comment:
Thanks for your answer, I also noticed this when I looked at the code
--
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: commits-unsubscribe@calcite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [CALCITE-6488] Ensure collations created by RelCollations are canonized once [calcite]
Posted by "rubenada (via GitHub)" <gi...@apache.org>.
rubenada commented on PR #3874:
URL: https://github.com/apache/calcite/pull/3874#issuecomment-2241531400
Thanks @caicancai , @asolimando , @NobiGo for the review!
--
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: commits-unsubscribe@calcite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [CALCITE-6488] Ensure collations created by RelCollations are canonized once [calcite]
Posted by "caicancai (via GitHub)" <gi...@apache.org>.
caicancai commented on code in PR #3874:
URL: https://github.com/apache/calcite/pull/3874#discussion_r1685336405
##########
core/src/main/java/org/apache/calcite/rel/RelCollations.java:
##########
@@ -270,7 +270,7 @@ public static RelCollation shift(RelCollation collation, int offset) {
for (RelFieldCollation fc : collation.getFieldCollations()) {
fieldCollations.add(fc.shift(offset));
}
- return new RelCollationImpl(fieldCollations.build());
+ return RelCollationTraitDef.INSTANCE.canonize(new RelCollationImpl(fieldCollations.build()));
Review Comment:
Looks good, maybe some JavaDoc could be added here
--
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: commits-unsubscribe@calcite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [CALCITE-6488] Ensure collations created by RelCollations are canonized once [calcite]
Posted by "asolimando (via GitHub)" <gi...@apache.org>.
asolimando commented on code in PR #3874:
URL: https://github.com/apache/calcite/pull/3874#discussion_r1685438425
##########
core/src/main/java/org/apache/calcite/rel/rules/SortJoinCopyRule.java:
##########
@@ -96,9 +96,7 @@ public SortJoinCopyRule(Class<? extends Sort> sortClass,
if (leftFieldCollation.isEmpty()) {
newLeftInput = join.getLeft();
} else {
- final RelCollation leftCollation =
- RelCollationTraitDef.INSTANCE.canonize(
- RelCollations.of(leftFieldCollation));
+ final RelCollation leftCollation = RelCollations.of(leftFieldCollation);
Review Comment:
[RelCollations.of](https://github.com/apache/calcite/pull/3874/files#diff-d50ce55582ce0f63226670b6234a635b70884a7055fce75df03043b4a77f9f62L85) is already canonizing, only shift needs to be changed to avoid the need of canonization in the callers (this is explained in details in the Jira ticket), so it looks good to me
--
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: commits-unsubscribe@calcite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [CALCITE-6488] Ensure collations created by RelCollations are canonized once [calcite]
Posted by "caicancai (via GitHub)" <gi...@apache.org>.
caicancai commented on code in PR #3874:
URL: https://github.com/apache/calcite/pull/3874#discussion_r1685341278
##########
core/src/main/java/org/apache/calcite/rel/rules/SortJoinCopyRule.java:
##########
@@ -96,9 +96,7 @@ public SortJoinCopyRule(Class<? extends Sort> sortClass,
if (leftFieldCollation.isEmpty()) {
newLeftInput = join.getLeft();
} else {
- final RelCollation leftCollation =
- RelCollationTraitDef.INSTANCE.canonize(
- RelCollations.of(leftFieldCollation));
+ final RelCollation leftCollation = RelCollations.of(leftFieldCollation);
Review Comment:
One question, why did you change it? I observed that you only changed the shift interface, and the shift interface was not called here.
Is it because this part of the code is redundant?
I observed that the return value of the of interface is return RelCollationTraitDef.INSTANCE.canonize(collation), and it seems that this part of the code is indeed redundant
--
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: commits-unsubscribe@calcite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [CALCITE-6488] Ensure collations created by RelCollations are canonized once [calcite]
Posted by "caicancai (via GitHub)" <gi...@apache.org>.
caicancai commented on code in PR #3874:
URL: https://github.com/apache/calcite/pull/3874#discussion_r1685341278
##########
core/src/main/java/org/apache/calcite/rel/rules/SortJoinCopyRule.java:
##########
@@ -96,9 +96,7 @@ public SortJoinCopyRule(Class<? extends Sort> sortClass,
if (leftFieldCollation.isEmpty()) {
newLeftInput = join.getLeft();
} else {
- final RelCollation leftCollation =
- RelCollationTraitDef.INSTANCE.canonize(
- RelCollations.of(leftFieldCollation));
+ final RelCollation leftCollation = RelCollations.of(leftFieldCollation);
Review Comment:
One question, why did you change it? I observed that you only changed the shift interface, and the shift interface was not called here because this part itself is redundant.
I observed that the return value of the of interface is return RelCollationTraitDef.INSTANCE.canonize(collation), and it seems that this part of the code is indeed redundant
--
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: commits-unsubscribe@calcite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [CALCITE-6488] Ensure collations created by RelCollations are canonized once [calcite]
Posted by "caicancai (via GitHub)" <gi...@apache.org>.
caicancai commented on code in PR #3874:
URL: https://github.com/apache/calcite/pull/3874#discussion_r1685341278
##########
core/src/main/java/org/apache/calcite/rel/rules/SortJoinCopyRule.java:
##########
@@ -96,9 +96,7 @@ public SortJoinCopyRule(Class<? extends Sort> sortClass,
if (leftFieldCollation.isEmpty()) {
newLeftInput = join.getLeft();
} else {
- final RelCollation leftCollation =
- RelCollationTraitDef.INSTANCE.canonize(
- RelCollations.of(leftFieldCollation));
+ final RelCollation leftCollation = RelCollations.of(leftFieldCollation);
Review Comment:
One question, why did you change it? I observed that you only changed the shift interface, and the shift interface was not called here because this part itself is redundant.
--
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: commits-unsubscribe@calcite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org