You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[C++] Arrow ipc format supports deduplication of dictionaries with dict_id, but there is no way to exercise it #49646
Arrow ipc format assigns dict_id to dictionary arrays and serializes dictionaries first.
It is allowed to use the same dict_id in multiple columns so you can serialize dictionary once and use multiple times.
Currently ipc writer always assigns new dict_id to every dictionary encountered. Hence, while the dictionary deduplication is supported by the ipc format, it can't be exercised by the user.
I suggest to add to IpcWriteOptions new option dedup_dictionaries. Please opine on the name of the option.
If enabled the writer will check every dictionary buffer is unique. The ipc writer will serialize only unique dictionaries to the file and reuse dict_ids.
I am interested in this feature and I can implement it if there are no objections across the dev community.
changed the title [-]Arrow ipc format supports deduplication of dictionaries with dict_id, but there is no way to exercise it[/-][+][C++] Arrow ipc format supports deduplication of dictionaries with dict_id, but there is no way to exercise it[/+]on Apr 2, 2026
Hi, I missed your request for comment.
Here is our use case. We are storing trades in arrow ipc files. Main assets like currency codes, equity names, interest rate curves, bond cusip codes are dictionarised. In this file currency code column appear more than 180 times. Main offender is the column with trade economics, it is the dense union column with trade types like IR swap, Equity Future, Bond Future, FX Option and etc. Dense union has around 70 alternatives. For these 70 alternatives: currency code appears more than 100 times, bond cusips 5 times, equity name 35 times, interest rate 60 times and etc. Bond dictionary has 200k+ elements repeated 5 times. Equity dictionary has 100k elements repeated 35 times.
We don't use plain strings because everything gets loaded into pytorch tensors in the end and pytorch doesn't work with strings.
We estimated that we would save 2.2 gb every day if would stop duplicating dictionaries
Activity
[-]Arrow ipc format supports deduplication of dictionaries with dict_id, but there is no way to exercise it[/-][+][C++] Arrow ipc format supports deduplication of dictionaries with dict_id, but there is no way to exercise it[/+]pitrou commentedon Jun 11, 2026
Sorry for the lack of earlier response. Did you encounter a use case where this would bring significant benefits?
Intuitively, in most cases the space savings won't be large, but deduplicating dictionaries will be costly in the write side.
pitrou commentedon Jun 11, 2026
Also note that deduplicating consecutive dictionaries inside a single column is supported:
arrow/cpp/src/arrow/ipc/writer.cc
Lines 1280 to 1315 in 4f3b0f0
cooldome commentedon Oct 20, 2026
Hi, I missed your request for comment.
Here is our use case. We are storing trades in arrow ipc files. Main assets like currency codes, equity names, interest rate curves, bond cusip codes are dictionarised. In this file currency code column appear more than 180 times. Main offender is the column with trade economics, it is the dense union column with trade types like IR swap, Equity Future, Bond Future, FX Option and etc. Dense union has around 70 alternatives. For these 70 alternatives: currency code appears more than 100 times, bond cusips 5 times, equity name 35 times, interest rate 60 times and etc. Bond dictionary has 200k+ elements repeated 5 times. Equity dictionary has 100k elements repeated 35 times.
We don't use plain strings because everything gets loaded into pytorch tensors in the end and pytorch doesn't work with strings.
We estimated that we would save 2.2 gb every day if would stop duplicating dictionaries