This is an automated email from the ASF dual-hosted git repository.

pitrou pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow.git


The following commit(s) were added to refs/heads/main by this push:
     new 6c82e246e2 GH-51780: [C++][IPC] Remove the mislabeled null check on 
schema fields in GetSchema (#51811)
6c82e246e2 is described below

commit 6c82e246e2019f1d926eb61b7f273d398adcd084
Author: Animesh Kumar <[email protected]>
AuthorDate: Wed Oct 7 20:48:37 2026 +0530

    GH-51780: [C++][IPC] Remove the mislabeled null check on schema fields in 
GetSchema (#51811)
    
    ### Rationale for this change
    
    In `GetSchema`, the loop over the schema's fields checked each `Field` for 
null with the label `"DictionaryEncoding.indexType"`. That label belongs to a 
different check, so if this one ever failed, the error would point at the wrong 
field. As the `XXX` comment next to it said, the check also can't fail: for a 
vector of tables, `fields()->Get(i)` returns the element's address plus its 
stored offset, never null. `Schema.fields` itself is already checked for null 
just above.
    
    ### What changes are included in this PR?
    
    The check and its comment are removed, which is the first option in the 
issue. Child fields in `FieldFromFlatbuffer` are already read through 
`children->Get(i)` without a null check, so top-level fields now match.
    
    ### Are these changes tested?
    
    No new test, since the removed check couldn't fail. The `arrow-ipc-*` tests 
pass locally.
    
    ### Are there any user-facing changes?
    
    No.
    
    ### Was AI used for this PR?
    
    In accordance to the [AI generation 
guidelines](https://arrow.apache.org/docs/dev/developers/overview.html#ai-generated-code),
 please disclose below whether and how AI was used in this PR.
    
    **PR code and description written by:**
    
    - [x] Human
    - [ ] AI
    
    **Reviewed before submission by:**
    
    - [x] Human
    - [ ] AI
    - [ ] Not reviewed
    
    * GitHub Issue: #51780
    
    Authored-by: Animesh Kumar <[email protected]>
    Signed-off-by: Antoine Pitrou <[email protected]>
---
 cpp/src/arrow/ipc/metadata_internal.cc | 2 --
 1 file changed, 2 deletions(-)

diff --git a/cpp/src/arrow/ipc/metadata_internal.cc 
b/cpp/src/arrow/ipc/metadata_internal.cc
index 94a9569161..02134aa805 100644
--- a/cpp/src/arrow/ipc/metadata_internal.cc
+++ b/cpp/src/arrow/ipc/metadata_internal.cc
@@ -1450,8 +1450,6 @@ Status GetSchema(const void* opaque_schema, 
DictionaryMemo* dictionary_memo,
   std::vector<std::shared_ptr<Field>> fields(num_fields);
   for (int i = 0; i < num_fields; ++i) {
     const flatbuf::Field* field = schema->fields()->Get(i);
-    // XXX I don't think this check is necessary (AP)
-    CHECK_FLATBUFFERS_NOT_NULL(field, "DictionaryEncoding.indexType");
     RETURN_NOT_OK(
         FieldFromFlatbuffer(field, field_pos.child(i), dictionary_memo, 
&fields[i]));
   }

Reply via email to