Repository navigation
[SPARK-46979][SS] Add support for specifying key and value encoder separately and also for each col family in RocksDB state store provider - #45038
Conversation
…tely and also for each col family in RocksDB state store provider
|
@HeartSaVioR - PTAL, thx ! |
sahnib
left a comment
There was a problem hiding this comment.
LGTM. Thanks for separating the encoders, this helps us avoid evolve the key/value encoders independently and use both Multi valued, and prefix key encoder.
HeartSaVioR
left a comment
There was a problem hiding this comment.
Only minors. Looks great in overall.
| "greater than the number of columns for prefix key!") | ||
|
|
||
| this.encoder = RocksDBStateEncoder.getEncoder(keySchema, valueSchema, numColsPrefixKey) | ||
| keyValueEncoderMap.putIfAbsent(StateStore.DEFAULT_COL_FAMILY_NAME, |
There was a problem hiding this comment.
(Maybe microbenchmark could tell that this could regress for default column family only - map lookup with carefully crafted lock operation in every op, though I'd rather not concern before we see actual regression.)
There was a problem hiding this comment.
Yea I didn't worry about it too much, given that the provider init likely happens once for long lived queries and where we can retain the use of the same provider on the same executor across m/batch executions.
There was a problem hiding this comment.
No, what I meant is to look up concurrent map per "every op" to figure out encoder, for existing stateful operators - previously it was just a reference to the field. But ops is relatively very cheap compared to commit as of now, so let's see.
There was a problem hiding this comment.
Ah ok - yea mainly didn't want to maintain 2 data structures for this. But if we find that its more expensive, then we can just split some of the logic for the default col family case
|
Thanks! Merging to master. |
What changes were proposed in this pull request?
Add support for specifying key and value encoder separately and also for each col family in RocksDB state store provider
Why are the changes needed?
This change allows us to specify encoder for key/values separately and avoid encoding additional bytes. Also, it allows us to set schemas/encoders for individual column families, which will be required for future changes related to transformWithState operator (listState/timer changes etc)
We are refactoring a bit here given the upcoming changes. so we are proposing to split key and value encoders.
Key encoders can be of 2 types:
Value encoders can also eventually be of 2 types:
And we now also allow setting schema and getting encoder for each column family.
So after the change, we can potentially allow something like this:
Does this PR introduce any user-facing change?
No
How was this patch tested?
Added unit tests
Was this patch authored or co-authored using generative AI tooling?
No