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/05/24 10:17:49 UTC

[GitHub] [arrow-rs] iyupeng opened a new pull request, #1736: Fix projection in IPC reader

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

   # 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 #1735 .
   
   # Rationale for this change
    Fix possible panic caused by projection in IPC reader.
   
    <!---
    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?
   Fix the function `read_record_batch` in `arrow/src/ipc/reader.rs`.
   
   <!---
   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?
   No.
   
   <!---
   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] viirya merged pull request #1736: Fix projection in IPC reader

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


-- 
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 #1736: Fix projection in IPC reader

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


##########
arrow/src/ipc/reader.rs:
##########
@@ -1390,43 +1390,167 @@ mod tests {
         });
     }
 
-    #[test]
-    fn test_projection_array_values() {
-        let schema = Schema::new(vec![
+    fn create_test_projection_schema() -> Schema {
+        // define field types
+        let list_data_type =
+            DataType::List(Box::new(Field::new("item", DataType::Int32, true)));
+
+        let fixed_size_list_data_type = DataType::FixedSizeList(
+            Box::new(Field::new("item", DataType::Int32, false)),
+            3,
+        );
+
+        let key_type = DataType::Int8;
+        let value_type = DataType::Utf8;
+        let dict_data_type =
+            DataType::Dictionary(Box::new(key_type), Box::new(value_type));
+
+        let union_fileds = vec![
+            Field::new("a", DataType::Int32, false),
+            Field::new("b", DataType::Float64, false),
+        ];
+        let union_data_type = DataType::Union(union_fileds, vec![0, 1], UnionMode::Dense);
+
+        let struct_fields = vec![
+            Field::new("id", DataType::Int32, false),
+            Field::new(
+                "list",
+                DataType::List(Box::new(Field::new("item", DataType::Int8, true))),
+                false,
+            ),
+        ];
+        let struct_data_type = DataType::Struct(struct_fields);
+
+        // define schema
+        Schema::new(vec![

Review Comment:
   👍 



-- 
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] codecov-commenter commented on pull request #1736: Fix projection in IPC reader

Posted by GitBox <gi...@apache.org>.
codecov-commenter commented on PR #1736:
URL: https://github.com/apache/arrow-rs/pull/1736#issuecomment-1136694183

   # [Codecov](https://codecov.io/gh/apache/arrow-rs/pull/1736?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#1736](https://codecov.io/gh/apache/arrow-rs/pull/1736?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (5a76cf3) into [master](https://codecov.io/gh/apache/arrow-rs/commit/ca1d85f746099c79b43700496042ed567d95c6cc?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (ca1d85f) will **decrease** coverage by `0.01%`.
   > The diff coverage is `73.80%`.
   
   ```diff
   @@            Coverage Diff             @@
   ##           master    #1736      +/-   ##
   ==========================================
   - Coverage   83.31%   83.30%   -0.02%     
   ==========================================
     Files         196      196              
     Lines       55961    56037      +76     
   ==========================================
   + Hits        46625    46681      +56     
   - Misses       9336     9356      +20     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/arrow-rs/pull/1736?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [arrow/src/ipc/reader.rs](https://codecov.io/gh/apache/arrow-rs/pull/1736/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-YXJyb3cvc3JjL2lwYy9yZWFkZXIucnM=) | `86.97% <73.80%> (-1.75%)` | :arrow_down: |
   | [arrow/src/array/transform/mod.rs](https://codecov.io/gh/apache/arrow-rs/pull/1736/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-YXJyb3cvc3JjL2FycmF5L3RyYW5zZm9ybS9tb2QucnM=) | `86.85% <0.00%> (+0.11%)` | :arrow_up: |
   | [parquet\_derive/src/parquet\_field.rs](https://codecov.io/gh/apache/arrow-rs/pull/1736/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGFycXVldF9kZXJpdmUvc3JjL3BhcnF1ZXRfZmllbGQucnM=) | `65.98% <0.00%> (+0.22%)` | :arrow_up: |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/arrow-rs/pull/1736?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/arrow-rs/pull/1736?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [ca1d85f...5a76cf3](https://codecov.io/gh/apache/arrow-rs/pull/1736?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   


-- 
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] iyupeng commented on pull request #1736: Fix projection in IPC reader

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

   Hi @viirya, I can add more commits to improve the test on projection. Please wait for some time before merging. 


-- 
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] iyupeng commented on pull request #1736: Fix projection in IPC reader

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

   Hi @viirya , thanks for your comment. A new test is added to IPC reader in my last 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] iyupeng commented on pull request #1736: Fix projection in IPC reader

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

   Hi @viirya , the test for projection has been improved to check more data types. It is ready for review 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 #1736: Fix projection in IPC reader

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

   Merged, thanks!


-- 
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 #1736: Fix projection in IPC reader

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


##########
arrow/src/ipc/reader.rs:
##########
@@ -275,6 +275,120 @@ fn create_array(
     Ok((array, node_index, buffer_index))
 }
 
+/// Skip fields based on data types to advance `node_index` and `buffer_index`.
+/// This function should be called when doing projection in fn `read_record_batch`.
+/// The advancement logic references fn `create_array`.
+fn skip_filed(

Review Comment:
   I think you mean:
   
   ```suggestion
   fn skip_field(
   ```



-- 
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 #1736: Fix projection in IPC reader

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

   Thank you @iyupeng 


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