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/19 13:12:44 UTC

[GitHub] [arrow-rs] HaoYang670 opened a new pull request, #2525: Clean the `create_array` in IPC reader.

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

   # 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.
   -->
   
   None.
   
   # What changes are included in this PR?
   Did some code cleaning work when I learnt the ipc reader code.
   
   # Are there any user-facing changes?
   No.
   


-- 
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] HaoYang670 commented on a diff in pull request #2525: Clean the `create_array` in IPC reader.

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


##########
arrow/src/ipc/reader.rs:
##########
@@ -433,28 +395,26 @@ fn skip_field(
 fn create_primitive_array(
     field_node: &ipc::FieldNode,
     data_type: &DataType,
-    buffers: Vec<Buffer>,
+    buffers: &[Buffer],
 ) -> ArrayRef {
     let length = field_node.length() as usize;
-    let null_count = field_node.null_count() as usize;
+    let null_buffer = (field_node.null_count() > 0).then_some(buffers[0].clone());
     let array_data = match data_type {
         Utf8 | Binary | LargeBinary | LargeUtf8 => {
-            // read 3 buffers
+            // read 3 buffers: null buffer (optional), offsets buffer and data buffer
             ArrayData::builder(data_type.clone())
                 .len(length)
                 .buffers(buffers[1..3].to_vec())
-                .offset(0)
-                .null_bit_buffer((null_count > 0).then(|| buffers[0].clone()))
+                .null_bit_buffer(null_buffer)
                 .build()

Review Comment:
   Will file an issue to track it.



-- 
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 #2525: Clean the `create_array` in IPC reader.

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


-- 
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 #2525: Clean the `create_array` in IPC reader.

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


##########
arrow/src/ipc/reader.rs:
##########
@@ -433,28 +395,26 @@ fn skip_field(
 fn create_primitive_array(
     field_node: &ipc::FieldNode,
     data_type: &DataType,
-    buffers: Vec<Buffer>,
+    buffers: &[Buffer],
 ) -> ArrayRef {
     let length = field_node.length() as usize;
-    let null_count = field_node.null_count() as usize;
+    let null_buffer = (field_node.null_count() > 0).then_some(buffers[0].clone());
     let array_data = match data_type {
         Utf8 | Binary | LargeBinary | LargeUtf8 => {
-            // read 3 buffers
+            // read 3 buffers: null buffer (optional), offsets buffer and data buffer
             ArrayData::builder(data_type.clone())
                 .len(length)
                 .buffers(buffers[1..3].to_vec())
-                .offset(0)
-                .null_bit_buffer((null_count > 0).then(|| buffers[0].clone()))
+                .null_bit_buffer(null_buffer)
                 .build()

Review Comment:
   IMO we should probably be validating all of them, I'm not sure why we aren't validating some of them... IPC is inherently not trusted



-- 
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] liukun4515 commented on pull request #2525: Clean the `create_array` in IPC reader.

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

   why the data in the ipc can't be trusted from this issue https://github.com/apache/arrow-rs/issues/2541 ?


-- 
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 #2525: Clean the `create_array` in IPC reader.

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

   Benchmark runs are scheduled for baseline = 98de2e3ccc9f74760de1edf7dc1f4e1a820f9acf and contender = 7cfe3cf6ab0d84b4f9d21c7ed43a04e7fdd6689b. 7cfe3cf6ab0d84b4f9d21c7ed43a04e7fdd6689b 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/bf83615d648b49f5a215ab675f91d28c...70cf5b221b27444787bbba454eae8ca5/)
   [Skipped :warning: Benchmarking of arrow-rs-commits is not supported on test-mac-arm] [test-mac-arm](https://conbench.ursa.dev/compare/runs/5e17a4ed1b4a4ab89eca66210d68d922...3701179f2e3e4909a06d29d0320b7975/)
   [Skipped :warning: Benchmarking of arrow-rs-commits is not supported on ursa-i9-9960x] [ursa-i9-9960x](https://conbench.ursa.dev/compare/runs/0cb07ddc90074ea08f76baab9a86f89a...8ec3ed57c8304217a9b70ec06c9fc930/)
   [Skipped :warning: Benchmarking of arrow-rs-commits is not supported on ursa-thinkcentre-m75q] [ursa-thinkcentre-m75q](https://conbench.ursa.dev/compare/runs/f0d9663dd5f847a1898468abcb7224f7...914c1aaef6704ba4ae90e7c177f24bff/)
   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] HaoYang670 commented on a diff in pull request #2525: Clean the `create_array` in IPC reader.

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


##########
arrow/src/ipc/reader.rs:
##########
@@ -433,28 +395,26 @@ fn skip_field(
 fn create_primitive_array(
     field_node: &ipc::FieldNode,
     data_type: &DataType,
-    buffers: Vec<Buffer>,
+    buffers: &[Buffer],
 ) -> ArrayRef {
     let length = field_node.length() as usize;
-    let null_count = field_node.null_count() as usize;
+    let null_buffer = (field_node.null_count() > 0).then_some(buffers[0].clone());
     let array_data = match data_type {
         Utf8 | Binary | LargeBinary | LargeUtf8 => {
-            // read 3 buffers
+            // read 3 buffers: null buffer (optional), offsets buffer and data buffer
             ArrayData::builder(data_type.clone())
                 .len(length)
                 .buffers(buffers[1..3].to_vec())
-                .offset(0)
-                .null_bit_buffer((null_count > 0).then(|| buffers[0].clone()))
+                .null_bit_buffer(null_buffer)
                 .build()

Review Comment:
   Why do we only validate the data when building these 4 types array, but for other types, we use `build_uncheked` ?



-- 
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] HaoYang670 commented on a diff in pull request #2525: Clean the `create_array` in IPC reader.

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


##########
arrow/src/ipc/reader.rs:
##########
@@ -433,28 +395,26 @@ fn skip_field(
 fn create_primitive_array(
     field_node: &ipc::FieldNode,
     data_type: &DataType,
-    buffers: Vec<Buffer>,
+    buffers: &[Buffer],
 ) -> ArrayRef {
     let length = field_node.length() as usize;
-    let null_count = field_node.null_count() as usize;
+    let null_buffer = (field_node.null_count() > 0).then_some(buffers[0].clone());
     let array_data = match data_type {
         Utf8 | Binary | LargeBinary | LargeUtf8 => {
-            // read 3 buffers
+            // read 3 buffers: null buffer (optional), offsets buffer and data buffer
             ArrayData::builder(data_type.clone())
                 .len(length)
                 .buffers(buffers[1..3].to_vec())
-                .offset(0)
-                .null_bit_buffer((null_count > 0).then(|| buffers[0].clone()))
+                .null_bit_buffer(null_buffer)
                 .build()

Review Comment:
   Why do we only do validation when building these 4 types array, but for other types, we use `build_uncheked` ?



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