Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ARROW-10121: [C++] Fix emission of new dictionaries in IPC writer #8302

Closed
wants to merge 3 commits into from

Conversation

pitrou
Copy link
Member

@pitrou pitrou commented Sep 29, 2020

When a dictionary changes from the previous batch, it is emitted again in the IPC stream.
If this happens when writing the IPC file format, an error is returned.

@pitrou
Copy link
Member Author

pitrou commented Sep 29, 2020

@wesm This is a first draft. It is functional (i.e. fixes the underlying issue) but doesn't try to detect deltas.

@github-actions
Copy link


// TODO: Check for delta dictionaries. Can we scan for deltas while computing
// the RecordBatch payload to save time?
RETURN_NOT_OK(WriteDictionaries(batch));
Copy link
Member

Choose a reason for hiding this comment

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

I assume this will populate last_dictionaries_ entries even when the length of the dictionary is zero? I recall there was some discussion about empty dictionaries (and whether they need to be written at all) at the start of a stream

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah, we can skip zero-length dictionaries explicitly, but won't it confuse the IPC reader?

Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure if skipped dictionaries will work, but they are permitted by the format, so it should probably be investigated in a follow up issue

cpp/src/arrow/ipc/writer.cc Show resolved Hide resolved
@pitrou
Copy link
Member Author

pitrou commented Sep 30, 2020

I still need to add tests for this (I'll do that once #8309 is merged). Detecting and writing delta dictionaries is not implemented, but that's a feature, not a bug, so it may also wait for another PR.
(also, it will have to be disabled by default, for compatibility with other IPC readers)

@pitrou pitrou marked this pull request as ready for review October 1, 2020 14:51
@pitrou
Copy link
Member Author

pitrou commented Oct 5, 2020

@wesm Do you want to review this again? Otherwise perhaps @bkietz ?

When a dictionary changes from the previous batch, we should re-emit it.
Move tensor tests in separate file
@wesm
Copy link
Member

wesm commented Oct 5, 2020

I can take a final look this morning.


// TODO: Check for delta dictionaries. Can we scan for deltas while computing
// the RecordBatch payload to save time?
RETURN_NOT_OK(WriteDictionaries(batch));
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure if skipped dictionaries will work, but they are permitted by the format, so it should probably be investigated in a follow up issue

@wesm wesm closed this in 72a0e96 Oct 5, 2020
@pitrou pitrou deleted the ARROW-10121-ipc-emit-dicts branch October 5, 2020 20:53
emkornfield pushed a commit to emkornfield/arrow that referenced this pull request Oct 16, 2020
When a dictionary changes from the previous batch, it is emitted again in the IPC stream.
If this happens when writing the IPC file format, an error is returned.

Closes apache#8302 from pitrou/ARROW-10121-ipc-emit-dicts

Authored-by: Antoine Pitrou <antoine@python.org>
Signed-off-by: Wes McKinney <wesm@apache.org>
GeorgeAp pushed a commit to sirensolutions/arrow that referenced this pull request Jun 7, 2021
When a dictionary changes from the previous batch, it is emitted again in the IPC stream.
If this happens when writing the IPC file format, an error is returned.

Closes apache#8302 from pitrou/ARROW-10121-ipc-emit-dicts

Authored-by: Antoine Pitrou <antoine@python.org>
Signed-off-by: Wes McKinney <wesm@apache.org>
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.

None yet

2 participants