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/08/15 18:41:33 UTC

[GitHub] [arrow-rs] psvri opened a new pull request, #2456: Utf8array casting

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

   # Which issue does this PR close?
   
   Closes #2402.
   
   # Rationale for this change
    
   Implement casting of utf8[large] to binary[large] in kernels::cast
   
   # What changes are included in this PR?
   
   - Added support for utf8[large] to binary[large] in kernels::cast
   - removed deprecated expressions like std::< numeric >::(MAX|MIN) in kernels::cast::test module
   - fixed  typo in doc comment of datatypes::is_numeric
   
   
   # Are there any user-facing changes?
   
   None
   


-- 
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 #2456: Utf8array casting

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


##########
arrow/src/compute/kernels/cast.rs:
##########
@@ -1254,6 +1258,24 @@ pub fn cast_with_options(
     }
 }
 
+/// Cast to string array to binary array
+fn cast_string_to_binary<OffsetSize>(array: &ArrayRef) -> Result<ArrayRef>
+where
+    OffsetSize: OffsetSizeTrait,
+{
+    let array = array
+        .as_any()
+        .downcast_ref::<GenericStringArray<OffsetSize>>()
+        .unwrap();
+
+    Ok(Arc::new(
+        array
+            .iter()
+            .map(|x| x.map(|data| data.as_bytes()))
+            .collect::<GenericBinaryArray<OffsetSize>>(),

Review Comment:
   As this isn't changing the size of the offsets, it would be significantly faster to just reuse the existing buffers
   
   Something like
   
   ```
   assert_eq(array.data_type(), DataType::Utf8);
   array.data().clone().into_builder().data_type(DataType::Binary).build_unchecked()
   ```
   And similar for LargeUtf8 and LargeBinary



-- 
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] Dandandan commented on pull request #2456: Utf8array casting

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

   Thanks @psvri !


-- 
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 #2456: Utf8array casting

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

   Benchmark runs are scheduled for baseline = 7a74465f2b8b622428e562f23298b7cce16886f7 and contender = 6a1b9ee8bed12e1fc8178f0c2e29ab24fcf9b9fc. 6a1b9ee8bed12e1fc8178f0c2e29ab24fcf9b9fc 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/a08a41983bf248ceb3ef9ea6effa2fb0...3d8c9d117e3649f490f044d91005b282/)
   [Skipped :warning: Benchmarking of arrow-rs-commits is not supported on test-mac-arm] [test-mac-arm](https://conbench.ursa.dev/compare/runs/e6d619a779cd4a478e30f138b86d147d...6f8b6afb9e914d558f02c7d031bd71cb/)
   [Skipped :warning: Benchmarking of arrow-rs-commits is not supported on ursa-i9-9960x] [ursa-i9-9960x](https://conbench.ursa.dev/compare/runs/e18104df709946e6990e3368c092bf25...b0ad94da49754932a5bd98041e5de86d/)
   [Skipped :warning: Benchmarking of arrow-rs-commits is not supported on ursa-thinkcentre-m75q] [ursa-thinkcentre-m75q](https://conbench.ursa.dev/compare/runs/1695b3619dfb42f0b0f4cee801872a66...99c2ca118ef34bac97d9e9b8d6b2a1e3/)
   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] psvri commented on a diff in pull request #2456: Utf8array casting

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


##########
arrow/src/compute/kernels/cast.rs:
##########
@@ -1254,6 +1258,24 @@ pub fn cast_with_options(
     }
 }
 
+/// Cast to string array to binary array
+fn cast_string_to_binary<OffsetSize>(array: &ArrayRef) -> Result<ArrayRef>
+where
+    OffsetSize: OffsetSizeTrait,
+{
+    let array = array
+        .as_any()
+        .downcast_ref::<GenericStringArray<OffsetSize>>()
+        .unwrap();
+
+    Ok(Arc::new(
+        array
+            .iter()
+            .map(|x| x.map(|data| data.as_bytes()))
+            .collect::<GenericBinaryArray<OffsetSize>>(),

Review Comment:
   Fixed it in latest commit



-- 
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 merged pull request #2456: Utf8array casting

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


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