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 2022/10/06 04:54:23 UTC

[GitHub] [arrow-rs] viirya opened a new pull request, #2830: Add NaN handling in dyn scalar comparison kernels

viirya opened a new pull request, #2830:
URL: https://github.com/apache/arrow-rs/pull/2830

   # 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 #2829.
   
   # 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.
   -->
   
   # 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 `breaking 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-rs] tustvold commented on a diff in pull request #2830: Add NaN handling in dyn scalar comparison kernels

Posted by GitBox <gi...@apache.org>.
tustvold commented on code in PR #2830:
URL: https://github.com/apache/arrow-rs/pull/2830#discussion_r988679454


##########
arrow/src/datatypes/native.rs:
##########
@@ -46,6 +46,7 @@ pub(crate) mod native_op {
         + Div<Output = Self>
         + Rem<Output = Self>
         + Zero
+        + num::ToPrimitive

Review Comment:
   But the dyn_scalar kernels don't use ArrowNativeTypeOp? 



-- 
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-rs] viirya commented on a diff in pull request #2830: Add NaN handling in dyn scalar comparison kernels

Posted by GitBox <gi...@apache.org>.
viirya commented on code in PR #2830:
URL: https://github.com/apache/arrow-rs/pull/2830#discussion_r988609227


##########
arrow/src/datatypes/native.rs:
##########
@@ -46,6 +46,7 @@ pub(crate) mod native_op {
         + Div<Output = Self>
         + Rem<Output = Self>
         + Zero
+        + num::ToPrimitive

Review Comment:
   Because kernels like `eq_dyn_scalar` have this type binding. In macro `dyn_compare_scalar`, `ToPrimitive` api is used on the input scalar.



-- 
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-rs] tustvold commented on pull request #2830: Add NaN handling in dyn scalar comparison kernels

Posted by GitBox <gi...@apache.org>.
tustvold commented on PR #2830:
URL: https://github.com/apache/arrow-rs/pull/2830#issuecomment-1269335825

   I wonder if it might be cleaner to use a trait for this that can be derived for T::Native, much like we do for arithmetic? 


-- 
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-rs] ursabot commented on pull request #2830: Add NaN handling in dyn scalar comparison kernels

Posted by GitBox <gi...@apache.org>.
ursabot commented on PR #2830:
URL: https://github.com/apache/arrow-rs/pull/2830#issuecomment-1270470779

   Benchmark runs are scheduled for baseline = f8c40372242ab096cd53118021d016cac4f0daed and contender = c93ce39567b73c56f11d4e731de102c532e3654d. c93ce39567b73c56f11d4e731de102c532e3654d is a master commit associated with this PR. Results will be available as each benchmark for each run completes.
   Conbench compare runs links:
   [Skipped :warning: Benchmarking of arrow-rs-commits is not supported on ec2-t3-xlarge-us-east-2] [ec2-t3-xlarge-us-east-2](https://conbench.ursa.dev/compare/runs/6dde4d5cf9c44b539df5e3dc2bb615a2...befaa6ae62ce418f9f48317c842dc164/)
   [Skipped :warning: Benchmarking of arrow-rs-commits is not supported on test-mac-arm] [test-mac-arm](https://conbench.ursa.dev/compare/runs/1a233f70d9fa4c47af892f102d5d8f42...e2452cb22cfa478f8e15fce73d24b53e/)
   [Skipped :warning: Benchmarking of arrow-rs-commits is not supported on ursa-i9-9960x] [ursa-i9-9960x](https://conbench.ursa.dev/compare/runs/ed7b04fa0ae54bc7a75045edf315e9fa...8d2f411c248d4fbe90670397646f5cf2/)
   [Skipped :warning: Benchmarking of arrow-rs-commits is not supported on ursa-thinkcentre-m75q] [ursa-thinkcentre-m75q](https://conbench.ursa.dev/compare/runs/7f80ab450a93440dbf9ec6650d082357...659051ccd77e4549ba39aca951f13394/)
   Buildkite builds:
   Supported benchmarks:
   ec2-t3-xlarge-us-east-2: Supported benchmark langs: Python, R. Runs only benchmarks with cloud = True
   test-mac-arm: Supported benchmark langs: C++, Python, R
   ursa-i9-9960x: Supported benchmark langs: Python, R, JavaScript
   ursa-thinkcentre-m75q: Supported benchmark langs: C++, Java
   


-- 
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-rs] viirya commented on a diff in pull request #2830: Add NaN handling in dyn scalar comparison kernels

Posted by GitBox <gi...@apache.org>.
viirya commented on code in PR #2830:
URL: https://github.com/apache/arrow-rs/pull/2830#discussion_r989224859


##########
arrow/src/datatypes/native.rs:
##########
@@ -46,6 +46,7 @@ pub(crate) mod native_op {
         + Div<Output = Self>
         + Rem<Output = Self>
         + Zero
+        + num::ToPrimitive

Review Comment:
   Hmm, found that it is not necessary to add the addition. Removed it now.



-- 
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-rs] viirya commented on pull request #2830: Add NaN handling in dyn scalar comparison kernels

Posted by GitBox <gi...@apache.org>.
viirya commented on PR #2830:
URL: https://github.com/apache/arrow-rs/pull/2830#issuecomment-1270462313

   The failed CI is for labeling only.


-- 
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-rs] viirya commented on pull request #2830: Add NaN handling in dyn scalar comparison kernels

Posted by GitBox <gi...@apache.org>.
viirya commented on PR #2830:
URL: https://github.com/apache/arrow-rs/pull/2830#issuecomment-1270462479

   Thanks @tustvold for reviewing.


-- 
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-rs] viirya merged pull request #2830: Add NaN handling in dyn scalar comparison kernels

Posted by GitBox <gi...@apache.org>.
viirya merged PR #2830:
URL: https://github.com/apache/arrow-rs/pull/2830


-- 
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-rs] tustvold commented on a diff in pull request #2830: Add NaN handling in dyn scalar comparison kernels

Posted by GitBox <gi...@apache.org>.
tustvold commented on code in PR #2830:
URL: https://github.com/apache/arrow-rs/pull/2830#discussion_r988604010


##########
arrow/src/datatypes/native.rs:
##########
@@ -46,6 +46,7 @@ pub(crate) mod native_op {
         + Div<Output = Self>
         + Rem<Output = Self>
         + Zero
+        + num::ToPrimitive

Review Comment:
   Why this addition?



-- 
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-rs] tustvold commented on a diff in pull request #2830: Add NaN handling in dyn scalar comparison kernels

Posted by GitBox <gi...@apache.org>.
tustvold commented on code in PR #2830:
URL: https://github.com/apache/arrow-rs/pull/2830#discussion_r989214673


##########
arrow/src/datatypes/native.rs:
##########
@@ -46,6 +46,7 @@ pub(crate) mod native_op {
         + Div<Output = Self>
         + Rem<Output = Self>
         + Zero
+        + num::ToPrimitive

Review Comment:
   Oh I see, could we possibly have the dyn_scalar kernels just have the constraint on `ToPrimitive + ArrowNativeTypeOp` instead of unifying them.
   
   This not only avoids this leaking to the arithmetic kernels, which will complicate porting decimals over, but it also seems wrong that the dyn kernels are performing type coercion on the scalar value at all, and I would like to keep the door open to removing this down the line.



-- 
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-rs] viirya commented on a diff in pull request #2830: Add NaN handling in dyn scalar comparison kernels

Posted by GitBox <gi...@apache.org>.
viirya commented on code in PR #2830:
URL: https://github.com/apache/arrow-rs/pull/2830#discussion_r989207792


##########
arrow/src/datatypes/native.rs:
##########
@@ -46,6 +46,7 @@ pub(crate) mod native_op {
         + Div<Output = Self>
         + Rem<Output = Self>
         + Zero
+        + num::ToPrimitive

Review Comment:
   I put `is_eq`, `is_ne`..APIs into `ArrowNativeTypeOp`.  If I don't add this addition, the compilier complains:
   
   ```
   error[E0599]: no method named `to_f64` found for type parameter `T` in the current scope
       --> arrow/src/compute/kernels/comparison.rs:1228:50
        |
   1228 |                 let right = try_to_type!($RIGHT, to_f64)?;
        |                                                  ^^^^^^ method not found in `T`
   ...
   1338 | pub fn eq_dyn_scalar<T>(left: &dyn Array, right: T) -> Result<BooleanArray>
        |                      - method `to_f64` not found for this type parameter              
   ...
   1340 |     T: ArrowNativeTypeOp + num::ToPrimitive,
        |                          ++++++++++++++++++
   ```
   
   So I pull the type bound `num::ToPrimitive` into `ArrowNativeTypeOp`. 
   
   I made all dyn_scalar kernels use `ArrowNativeTypeOp` now.



-- 
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-rs] viirya commented on pull request #2830: Add NaN handling in dyn scalar comparison kernels

Posted by GitBox <gi...@apache.org>.
viirya commented on PR #2830:
URL: https://github.com/apache/arrow-rs/pull/2830#issuecomment-1269346660

   > I wonder if it might be cleaner to use a trait for this that can be derived for T::Native, much like we do for arithmetic? Using the dyn downcasting machinery feels like a bit of a hack...
   
   Hm, okay. Yea, current approach not looks very clear due to downcasting and try_cast.


-- 
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-rs] viirya commented on a diff in pull request #2830: Add NaN handling in dyn scalar comparison kernels

Posted by GitBox <gi...@apache.org>.
viirya commented on code in PR #2830:
URL: https://github.com/apache/arrow-rs/pull/2830#discussion_r989207792


##########
arrow/src/datatypes/native.rs:
##########
@@ -46,6 +46,7 @@ pub(crate) mod native_op {
         + Div<Output = Self>
         + Rem<Output = Self>
         + Zero
+        + num::ToPrimitive

Review Comment:
   I put `is_eq`, `is_ne`..APIs into `ArrowNativeTypeOp`.  dyn_scalar kernels use `ArrowNativeTypeOp` now.



-- 
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-rs] tustvold commented on a diff in pull request #2830: Add NaN handling in dyn scalar comparison kernels

Posted by GitBox <gi...@apache.org>.
tustvold commented on code in PR #2830:
URL: https://github.com/apache/arrow-rs/pull/2830#discussion_r989253984


##########
arrow/src/datatypes/native.rs:
##########
@@ -46,6 +46,7 @@ pub(crate) mod native_op {
         + Div<Output = Self>
         + Rem<Output = Self>
         + Zero
+        + num::ToPrimitive

Review Comment:
   Thank you - FWIW I filed https://github.com/apache/arrow-rs/issues/2837 to deal with the somewhat surprising, at least to me, behaviour of these scalar kernels



-- 
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-rs] tustvold commented on a diff in pull request #2830: Add NaN handling in dyn scalar comparison kernels

Posted by GitBox <gi...@apache.org>.
tustvold commented on code in PR #2830:
URL: https://github.com/apache/arrow-rs/pull/2830#discussion_r989214673


##########
arrow/src/datatypes/native.rs:
##########
@@ -46,6 +46,7 @@ pub(crate) mod native_op {
         + Div<Output = Self>
         + Rem<Output = Self>
         + Zero
+        + num::ToPrimitive

Review Comment:
   Oh I see, could we possibly have the dyn_scalar kernels just have the constraint on `ToPrimitive + ArrowNativeTypeOp` instead of unifying them.
   
   This not only avoids this leaking to the arithmetic kernels, which will complicate porting decimals over, but it also seems wrong that the dyn kernels are performing type coercion on the scalar value at all, and I would very much like to remove this if possible.



-- 
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