You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2021/08/08 17:37:37 UTC
[GitHub] [arrow-datafusion] viirya opened a new pull request #838: Implement PartialOrd for ScalarValue
viirya opened a new pull request #838:
URL: https://github.com/apache/arrow-datafusion/pull/838
# Which issue does this PR close?
<!--
We generally require a GitHub issue to be filed for all bug fixes and enhancements and this helps us generate change logs for our releases. You can link an issue to this PR using the GitHub syntax. For example `Closes #123` indicates that this PR will close issue #123.
-->
Closes #.
# Rationale for this change
<!--
Why are you proposing this change? If this is already explained clearly in the issue then this section is not needed.
Explaining clearly why changes are proposed helps reviewers understand your changes and offer better suggestions for fixes.
-->
Making it possible to compare `ScalaValue`. It is for better code reuse. Otherwise the users of `ScalaValue` might need to compare `ScalaValue` manually in their code.
# What changes are included in this PR?
<!--
There is no need to duplicate the description in the issue here but it is sometimes worth providing a summary of the individual changes in this PR.
-->
# Are there any user-facing changes?
<!--
If there are user-facing changes then we may require documentation to be updated before approving the PR.
-->
<!--
If there are any breaking changes to public APIs, please add the `api change` label.
-->
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-datafusion] viirya commented on pull request #838: Implement PartialOrd for ScalarValue
Posted by GitBox <gi...@apache.org>.
viirya commented on pull request #838:
URL: https://github.com/apache/arrow-datafusion/pull/838#issuecomment-894877422
Thanks @Dandandan @houqp !
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-datafusion] houqp commented on a change in pull request #838: Implement PartialOrd for ScalarValue
Posted by GitBox <gi...@apache.org>.
houqp commented on a change in pull request #838:
URL: https://github.com/apache/arrow-datafusion/pull/838#discussion_r684813561
##########
File path: datafusion/src/scalar.rs
##########
@@ -156,6 +157,58 @@ impl PartialEq for ScalarValue {
}
}
+// manual implementation of `PartialOrd` that uses OrderedFloat to
+// get defined behavior for floating point
+impl PartialOrd for ScalarValue {
+ fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
+ use ScalarValue::*;
+ // This purposely doesn't have a catch-all "(_, _)" so that
+ // any newly added enum variant will require editing this list
+ // or else face a compile error
Review comment:
this comment doesn't seem to hold true anymore in this function, would be better to keep the same structure in `PartialEq` so we can also avoid catch all match 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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-datafusion] viirya commented on pull request #838: Implement PartialOrd for ScalarValue
Posted by GitBox <gi...@apache.org>.
viirya commented on pull request #838:
URL: https://github.com/apache/arrow-datafusion/pull/838#issuecomment-894830281
cc @houqp @Dandandan
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-datafusion] viirya commented on a change in pull request #838: Implement PartialOrd for ScalarValue
Posted by GitBox <gi...@apache.org>.
viirya commented on a change in pull request #838:
URL: https://github.com/apache/arrow-datafusion/pull/838#discussion_r684826624
##########
File path: datafusion/src/scalar.rs
##########
@@ -156,6 +157,58 @@ impl PartialEq for ScalarValue {
}
}
+// manual implementation of `PartialOrd` that uses OrderedFloat to
+// get defined behavior for floating point
+impl PartialOrd for ScalarValue {
+ fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
+ use ScalarValue::*;
+ // This purposely doesn't have a catch-all "(_, _)" so that
+ // any newly added enum variant will require editing this list
+ // or else face a compile error
Review comment:
Good suggestion! Updated.
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-datafusion] houqp merged pull request #838: Implement PartialOrd for ScalarValue
Posted by GitBox <gi...@apache.org>.
houqp merged pull request #838:
URL: https://github.com/apache/arrow-datafusion/pull/838
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org