Skip to content

fix(ipc): Decode a DictionaryEncoding without indexType as int32 indices - #957

Merged
ianmcook merged 1 commit into
apache:mainfrom
CaptainAni187:fix/dictionary-default-index-type-956
Oct 9, 2026
Merged

ianmcook merged 1 commit into
apache:mainfrom
CaptainAni187:fix/dictionary-default-index-type-956

Conversation

@CaptainAni187

Copy link
Copy Markdown
Contributor

Closes #956

Schema.fbs says that when DictionaryEncoding.indexType is null, the indices must be signed int32. The decoder passed the missing table straight to ArrowIpcDecoderSetTypeInt(), which crashed (a segfault in release builds, flatcc's "null pointer table access" assertion in debug builds). It now uses int32 when the field isn't present.

The new NanoarrowIpcDecodeDictionarySchemaWithoutIndexType test decodes a schema message with one dictionary<values=string, indices=int32> field that pyarrow 25.0.1 wrote, with indexType then removed from it. It crashes without the fix. I also read the WITHOUT_INDEX_TYPE stream from the issue with ArrowIpcArrayStreamReader: it now gives struct<text: dictionary(int32)<string>> with the values a b a, the same as the stream that has indexType.

ctest passes (384 tests, compression tests skipped), and pre-commit passes on the changed files.

Schema.fbs says that a null DictionaryEncoding.indexType means signed
int32 indices, but the decoder passed the missing table to
ArrowIpcDecoderSetTypeInt() and crashed. Use int32 when the field is
absent.

Closes apache#956

@paleolimbot paleolimbot left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On green CI this is good to merge...thank you!

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 33.33333% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 78.20%. Comparing base (ecba475) to head (af4ef30).

Files with missing lines Patch % Lines
src/nanoarrow/ipc/decoder.c 33.33% 0 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #957      +/-   ##
==========================================
- Coverage   78.20%   78.20%   -0.01%     
==========================================
  Files         106      106              
  Lines       16849    16851       +2     
  Branches     1986     1988       +2     
==========================================
+ Hits        13177    13178       +1     
  Misses       2438     2438              
- Partials     1234     1235       +1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

IPC decoder crashes on a DictionaryEncoding without indexType

4 participants