You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by GitBox <gi...@apache.org> on 2021/09/19 20:31:28 UTC
[GitHub] [iceberg] rdblue opened a new pull request #3152: API: Test for identity in comparators
rdblue opened a new pull request #3152:
URL: https://github.com/apache/iceberg/pull/3152
This adds identity cases for comparators. If the arguments to `compare` are the same object, return that the two are equal without more expensive checks.
--
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: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
[GitHub] [iceberg] rdblue commented on a change in pull request #3152: API: Test for identity in comparators
Posted by GitBox <gi...@apache.org>.
rdblue commented on a change in pull request #3152:
URL: https://github.com/apache/iceberg/pull/3152#discussion_r711799012
##########
File path: api/src/main/java/org/apache/iceberg/types/Comparators.java
##########
@@ -187,15 +195,18 @@ private NullsFirst() {
@Override
public int compare(T o1, T o2) {
+ if (o1 == o2) {
+ return 0;
+ }
+
if (o1 != null) {
if (o2 != null) {
return 0;
}
return 1;
- } else if (o2 != null) {
- return -1;
}
- return 0;
+
+ return -1;
Review comment:
The `o1 == o2` case removes the possibility that both are null, so `o2` must be non-null 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: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
[GitHub] [iceberg] rdblue commented on a change in pull request #3152: API: Test for identity in comparators
Posted by GitBox <gi...@apache.org>.
rdblue commented on a change in pull request #3152:
URL: https://github.com/apache/iceberg/pull/3152#discussion_r711799053
##########
File path: api/src/main/java/org/apache/iceberg/types/Comparators.java
##########
@@ -212,15 +223,18 @@ private NullsLast() {
@Override
public int compare(T o1, T o2) {
+ if (o1 == o2) {
+ return 0;
+ }
+
if (o1 != null) {
if (o2 != null) {
return 0;
}
return -1;
- } else if (o2 != null) {
- return 1;
}
- return 0;
+
+ return 1;
Review comment:
Like above, the `o1 == o2` case removes the possibility that `o2` is null. Otherwise, it would be equal to `o1`.
--
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: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
[GitHub] [iceberg] rdblue merged pull request #3152: API: Test for identity in comparators
Posted by GitBox <gi...@apache.org>.
rdblue merged pull request #3152:
URL: https://github.com/apache/iceberg/pull/3152
--
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: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
[GitHub] [iceberg] rdblue commented on pull request #3152: API: Test for identity in comparators
Posted by GitBox <gi...@apache.org>.
rdblue commented on pull request #3152:
URL: https://github.com/apache/iceberg/pull/3152#issuecomment-923239137
Merged. Thanks for reviewing, @kbendick and @jackye1995!
--
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: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org