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/06/17 04:07:38 UTC

[GitHub] [arrow-rs] viirya opened a new pull request, #1893: Correct nullable in read_dictionary

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

   # 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 #1892.
   
   # 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] viirya commented on a diff in pull request #1893: Correct nullable in read_dictionary

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


##########
arrow/src/ipc/reader.rs:
##########
@@ -702,7 +702,11 @@ pub fn read_dictionary(
         DataType::Dictionary(_, ref value_type) => {
             // Make a fake schema for the dictionary batch.
             let schema = Schema {
-                fields: vec![Field::new("", value_type.as_ref().clone(), false)],
+                fields: vec![Field::new(
+                    "",
+                    value_type.as_ref().clone(),
+                    first_field.is_nullable(),

Review Comment:
   This is actually for #1890. As #1890 adds a validation for non-nullable field containing null values at RecordBatch. When we read the dictionary value as record batch by `read_record_batch`. It will fail the validation.  Dictionaries are encoded as a sequence of record batches, each having a single field, in IPC messages.



-- 
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 #1893: Correct nullable in read_dictionary

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


##########
arrow/src/ipc/reader.rs:
##########
@@ -702,7 +702,11 @@ pub fn read_dictionary(
         DataType::Dictionary(_, ref value_type) => {
             // Make a fake schema for the dictionary batch.
             let schema = Schema {
-                fields: vec![Field::new("", value_type.as_ref().clone(), false)],
+                fields: vec![Field::new(
+                    "",
+                    value_type.as_ref().clone(),
+                    first_field.is_nullable(),

Review Comment:
   So we decode it as a record batch, and then get the single array from it.



##########
arrow/src/ipc/reader.rs:
##########
@@ -702,7 +702,11 @@ pub fn read_dictionary(
         DataType::Dictionary(_, ref value_type) => {
             // Make a fake schema for the dictionary batch.
             let schema = Schema {
-                fields: vec![Field::new("", value_type.as_ref().clone(), false)],
+                fields: vec![Field::new(
+                    "",
+                    value_type.as_ref().clone(),
+                    first_field.is_nullable(),

Review Comment:
   So we decode it as a record batch, and then get the single array from it as value array.



-- 
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 #1893: Correct nullable in read_dictionary

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

   # [Codecov](https://codecov.io/gh/apache/arrow-rs/pull/1893?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 [#1893](https://codecov.io/gh/apache/arrow-rs/pull/1893?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (5a7ffee) into [master](https://codecov.io/gh/apache/arrow-rs/commit/2e3d8ddd03e55516269d4c03865625615ca1655a?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (2e3d8dd) will **decrease** coverage by `0.00%`.
   > The diff coverage is `100.00%`.
   
   > :exclamation: Current head 5a7ffee differs from pull request most recent head 7f9d407. Consider uploading reports for the commit 7f9d407 to get more accurate results
   
   ```diff
   @@            Coverage Diff             @@
   ##           master    #1893      +/-   ##
   ==========================================
   - Coverage   83.48%   83.48%   -0.01%     
   ==========================================
     Files         203      203              
     Lines       57141    57141              
   ==========================================
   - Hits        47705    47703       -2     
   - Misses       9436     9438       +2     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/arrow-rs/pull/1893?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/1893/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=) | `90.82% <100.00%> (ø)` | |
   | [arrow/src/datatypes/datatype.rs](https://codecov.io/gh/apache/arrow-rs/pull/1893/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-YXJyb3cvc3JjL2RhdGF0eXBlcy9kYXRhdHlwZS5ycw==) | `65.42% <0.00%> (-0.38%)` | :arrow_down: |
   | [parquet\_derive/src/parquet\_field.rs](https://codecov.io/gh/apache/arrow-rs/pull/1893/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.53% <0.00%> (-0.23%)` | :arrow_down: |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/arrow-rs/pull/1893?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/1893?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 [2e3d8dd...7f9d407](https://codecov.io/gh/apache/arrow-rs/pull/1893?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] viirya commented on a diff in pull request #1893: Correct nullable in read_dictionary

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


##########
arrow/src/ipc/reader.rs:
##########
@@ -702,7 +702,11 @@ pub fn read_dictionary(
         DataType::Dictionary(_, ref value_type) => {
             // Make a fake schema for the dictionary batch.
             let schema = Schema {
-                fields: vec![Field::new("", value_type.as_ref().clone(), false)],
+                fields: vec![Field::new(
+                    "",
+                    value_type.as_ref().clone(),
+                    first_field.is_nullable(),

Review Comment:
   Okay, that sounds correct to me.



-- 
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 #1893: Correct nullable in read_dictionary

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


##########
arrow/src/ipc/reader.rs:
##########
@@ -702,7 +702,11 @@ pub fn read_dictionary(
         DataType::Dictionary(_, ref value_type) => {
             // Make a fake schema for the dictionary batch.
             let schema = Schema {
-                fields: vec![Field::new("", value_type.as_ref().clone(), false)],
+                fields: vec![Field::new(
+                    "",
+                    value_type.as_ref().clone(),
+                    first_field.is_nullable(),

Review Comment:
   Could you expand a bit on what is going on here and why? Whilst dictionary values can contain nulls, this and the null count describe the nullability of the values not the keys.
   
   I'm basically a little confused what this record batch actually is, and why it isn't just an ArrarRef...



-- 
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 #1893: Correct nullable in read_dictionary

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


##########
arrow/src/ipc/reader.rs:
##########
@@ -702,7 +702,11 @@ pub fn read_dictionary(
         DataType::Dictionary(_, ref value_type) => {
             // Make a fake schema for the dictionary batch.
             let schema = Schema {
-                fields: vec![Field::new("", value_type.as_ref().clone(), false)],
+                fields: vec![Field::new(
+                    "",
+                    value_type.as_ref().clone(),
+                    first_field.is_nullable(),

Review Comment:
   Should it not be nullable = true, as we don't actually know if the dictionary values may or may not contain nulls?



-- 
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 #1893: Correct nullable in read_dictionary

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


-- 
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 #1893: Correct nullable in read_dictionary

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


##########
arrow/src/ipc/reader.rs:
##########
@@ -702,7 +702,11 @@ pub fn read_dictionary(
         DataType::Dictionary(_, ref value_type) => {
             // Make a fake schema for the dictionary batch.
             let schema = Schema {
-                fields: vec![Field::new("", value_type.as_ref().clone(), false)],
+                fields: vec![Field::new(
+                    "",
+                    value_type.as_ref().clone(),
+                    first_field.is_nullable(),

Review Comment:
   Okay, that sounds correct to me. `first_field`'s nullability could be different to values.



-- 
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 #1893: Correct nullable in read_dictionary

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


##########
arrow/src/ipc/reader.rs:
##########
@@ -702,7 +702,11 @@ pub fn read_dictionary(
         DataType::Dictionary(_, ref value_type) => {
             // Make a fake schema for the dictionary batch.
             let schema = Schema {
-                fields: vec![Field::new("", value_type.as_ref().clone(), false)],
+                fields: vec![Field::new(
+                    "",
+                    value_type.as_ref().clone(),
+                    first_field.is_nullable(),

Review Comment:
   Should it not be nullable = true, as we don't actually know if the dictionary values may or may not contain nulls? The nullability of the dictionary encoded array as a whole is independent of the dictionary values array?



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