Repository navigation
feat: support record batch custom metadata - #85
Merged
Merged
Conversation
Decode and encode the Arrow IPC Message custom_metadata field for record batches. tableFromIPC exposes it as Table.batchMetadata, one Map (or null) per record batch, and tableToIPC writes it from a new batchMetadata option that defaults to the table property, so metadata survives a decode/encode round trip. Tables without batch metadata are unchanged. Closes uwdata#84. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
jheer
approved these changes
Nov 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements the proposal in #84. Closes #84.
The Arrow IPC
Messagetable carries an optionalcustom_metadatafield. Flechette currently drops it on decode and never writes it (src/encode/message.jsmarked itNOT SUPPORTED). This PR adds it for record batch messages:tableFromIPCsetstable.batchMetadatato an array with oneMap<string, string>(ornull) per record batch. If no batch carries metadata it staysnull, and decoded record batch objects are unchanged.tableToIPC(table, { batchMetadata })writes entry i on the i-th record batch message. The option defaults totable.batchMetadata, so a decode → encode round trip keeps the metadata, and a constructed table can set the property directly. Supplying more entries than the table has record batches throws, instead of silently dropping metadata.select/selectAtcarrybatchMetadataover, because the selected columns share the same record batches.On the open questions from #84: this covers record batches only. Dictionary batch metadata is not surfaced, since nothing in the Table model would hold it, and Arrow JS exposes only
RecordBatch.metadata. The property lives onTablebecause Flechette tables have no record batch objects; batch i corresponds tocolumn.data[i].The change adds 137 lines, 81 of them tests. Reading reuses the existing
decodeMetadata, and writing reuses the existingencodeMetadata, passed intowriteMessage.Validation:
RecordBatch.metadata, including dictionary columnsnullwhen absent,select, and the too-many-entries errorread_next_batch_with_custom_metadatawith the same metadata per batch.I'm happy to change the property name or API shape if you'd prefer something else.