GH-54958: [Format] Add custom_metadata to DictionaryEncoding for the dictionary value type #54959
All Vouch review confidence checks passed
Residual risk 0.29 = Change Risk (0.52) × (1 − Review Confidence (0.45)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.52 · 432 lines diff across 5 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.363
Shallow Review Depth
shallow_review_depth
0.344
Real PR Conversation Timeline
1 comments
"Review active on #54959"
general
weight: 0.35
rustyconover
Rationale for this change
This PR was split out of #53994 at review request, so that the specification change can be reviewed on its own.
In IPC, a dictionary-encoded column is a single
Fieldwhose type is the value type. The only metadata slot wasField.custom_metadata, sodictionary<values=extension<X>>andextension<X, storage=dictionary<...>>serialized identically. Arrow C++ reads both as the latter, so pyarrow cannot read back its own stream ofpa.dictionary(pa.int32(), pa.uuid()). The dev@ thread (https://lists.apache.org/thread/4xj0yrl2vn0lbrv39p3dvd28okvkjxyz) reached lazy consensus on adding KeyValue metadata for the value type toDictionaryEncoding(option 1).This is a format change, so it needs a
[VOTE]on dev@ and two reference implementations (see below).What changes are included in this PR?
format/Schema.fbs: an optionalcustom_metadata: [KeyValue]appended toDictionaryEncoding. It is thecustom_metadataof the dictionary value type, with the same semantics asField.custom_metadata(including the reservedARROW:extension:keys) but applied to the dictionary values. It is the IPC counterpart ofArrowSchema.dictionary->metadatain the C Data Interface.Columnar.rst: a new "Dictionary-encoded extension types" section. The format version is bumped to 1.6.- Writers should put a value extension type's
ARROW:extension:name/ARROW:extension:metadatathere rather than inField.custom_metadata.- Readers apply it to the value type before wrapping it in the dictionary type, then apply
Field.custom_metadataas before.- Extension types whose storage type is a dictionary keep using
Field.custom_metadata, as today.Versioning.rst: the version 1.6 entry.CDataInterface.rst: a note thatArrowSchema.dictionary->metadataholds the metadata of the dictionary value type, and how it maps to the two IPCcustom_metadataslots.Integration.rst: a matching optional"metadata"member in the"dictionary"object of the integration JSON format, with an example.The member is appended, so it is backward compatible.
MetadataVersionstays V5, and the file footer and Flight need no other change. Readers that predate it ignore it and read a dictionary of the storage type.Generated flatbuffers code is not included. Each implementation regenerates its bindings in its own PR.
Are these changes tested?
This PR changes only the specification. It is exercised by the implementations and a new
dictionary_extensionarchery integration case:ArrowSchema.dictionary->metadata: apache/arrow-nanoarrow#972Are there any user-facing changes?
Yes, this is a format addition (version 1.6). Writers that adopt it move a dictionary value type's extension keys from
Field.custom_metadatatoDictionaryEncoding.custom_metadata. Readers that predate it read such columns as a plain dictionary of the storage type and lose the extension type.Was AI used for this PR?
PR code and description written by:
Reviewed before submission by:
GitHub Issue: #54958
🤖 Generated with Claude Code