You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "linhongyu510 (via GitHub)" <gi...@apache.org> on 2026/09/03 06:47:21 UTC

[PR] fix(arrow-data): align struct null validation with parent offset [arrow-rs]

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

   # Which issue does this PR close?
   
   - Closes #10951.
   
   # Rationale for this change
   
   For a struct with a non-zero parent offset, visible parent row `i` maps to child row `offset + i`. Nullability validation compared the visible parent null buffer against the unsliced child null buffer, so it could reject masked child nulls and accept visible child nulls.
   
   # What changes are included in this PR?
   
   - Slice each struct child to the parent-visible window before validating non-nullable fields.
   - Add a regression test covering both the correctly masked and incorrectly unmasked cases.
   
   # Are these changes tested?
   
   Yes. TDD evidence on `main` at `c134baf8f`:
   
   - Before the production change, the focused regression failed because the correctly masked child null was rejected.
   - After the change, the focused regression passes.
   - `cargo test -p arrow-data --lib`: 56 passed.
   - `cargo fmt --all -- --check`: passed.
   - `cargo clippy -p arrow-data --all-targets -- -D warnings`: passed.
   - `git diff --check`: passed.
   
   # Are there any user-facing changes?
   
   Yes. Validation now correctly accepts child nulls masked by a sliced struct parent and rejects child nulls visible through a non-null parent row. There are no API changes.
   
   # AI assistance
   
   I used AI assistance to investigate the validation path, implement the focused test and fix, and prepare this description. I reviewed the complete diff and verified the behavior with the commands above.


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


Re: [PR] fix(arrow-data): align struct null validation with parent offset [arrow-rs]

Posted by "Jefffrey (via GitHub)" <gi...@apache.org>.
Jefffrey commented on PR #10970:
URL: https://github.com/apache/arrow-rs/pull/10970#issuecomment-5548086326

   thanks @linhongyu510 


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


Re: [PR] fix(arrow-data): align struct null validation with parent offset [arrow-rs]

Posted by "Jefffrey (via GitHub)" <gi...@apache.org>.
Jefffrey commented on code in PR #10970:
URL: https://github.com/apache/arrow-rs/pull/10970#discussion_r3924172697


##########
arrow-data/src/data.rs:
##########
@@ -1544,7 +1544,8 @@ impl ArrayData {
             DataType::Struct(fields) => {
                 for (field, child) in fields.iter().zip(&self.child_data) {
                     if !field.is_nullable() {
-                        self.validate_non_nullable(self.nulls(), child)?
+                        let child = child.slice(self.offset, self.len);
+                        self.validate_non_nullable(self.nulls(), &child)?

Review Comment:
   i feel we can modify `validate_non_nullable` to take in the child nulls, which we can slice here, instead of slicing the entire child which clones 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


Re: [PR] fix(arrow-data): align struct null validation with parent offset [arrow-rs]

Posted by "Jefffrey (via GitHub)" <gi...@apache.org>.
Jefffrey merged PR #10970:
URL: https://github.com/apache/arrow-rs/pull/10970


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


Re: [PR] fix(arrow-data): align struct null validation with parent offset [arrow-rs]

Posted by "linhongyu510 (via GitHub)" <gi...@apache.org>.
linhongyu510 commented on PR #10970:
URL: https://github.com/apache/arrow-rs/pull/10970#issuecomment-5547166220

   Addressed the review in 10a396f68: `validate_non_nullable` now receives the relevant child `NullBuffer`, and Struct validation slices only that bitmap at the parent offset instead of cloning the full child `ArrayData`. `cargo test -p arrow-data` passed (56 unit + 13 doctests), plus workspace fmt and Clippy with `-D warnings`.


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