Skip to content

Add parseArrowToTables for parsing concatenated multi-stream Arrow IPC buffers - #49

Open
ChaotX wants to merge 1 commit into
KxSystems:mainfrom
ChaotX:pr/parse-arrow-to-tables
Open

ChaotX wants to merge 1 commit into
KxSystems:mainfrom
ChaotX:pr/parse-arrow-to-tables

Conversation

@ChaotX

@ChaotX ChaotX commented Oct 2, 2026

Copy link
Copy Markdown

Closes #46

A single IPC stream reader only consumes the one logical stream at the head
of its input, so a buffer produced by concatenating multiple self-contained
Arrow IPC streams (e.g. repeated serializeArrow output joined together)
can't be parsed by parseArrowData/readArrowData - only the first stream
is read.

parseArrowToTables walks such a buffer, opening a fresh reader at each
offset and advancing by exactly what that reader consumed, returning one
kdb table per logical stream found. Supports the same DECIMAL128_AS_DOUBLE
and WITH_NULL_BITMAP options as parseArrowData.

…C buffers

Walks a buffer of concatenated Arrow IPC streams and returns one kdb
table per logical stream found, since a single IPC reader only
consumes the stream at the head of its input. Supports the same
DECIMAL128_AS_DOUBLE and WITH_NULL_BITMAP options as parseArrowData.
@nmcdonnell-kx

Copy link
Copy Markdown
Collaborator

Is this batching of multiple arrow IPC streams into a single buffer an officially recognised pattern? Do any of the Apache Arrow docs talk about doing this?
I'm just concerned that doing this do by checking how many bytes have been consumed by the reader seems a bit flakey. There's no guarantee it will stop at exactly the boundary between the streams - it may read ahead (as long as it doesn't go past the end of buffer) for performance reasons, even thought it doesn't actually need then (favouring progressing larger blocks).
Also, are these boundaries word aligned? I don't know it that's required by the reader but it'll certainly prefer it.
In any case arrow::io::BufferReader::Tell() isn't actually returning the number of bytes which were consumed. Rather it returns where the pointer into the buffer was last positioned. Again, the reader may move it back and forth - it there any guarantee that it actually leaves it at the the end of the stream?

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.

Support parsing concatenated multi-stream Arrow IPC buffers

2 participants