Skip to content

Conversation

@zeruibao
Copy link
Contributor

What changes were proposed in this pull request?

Add support for multiGet and deleteRange for Rocksdb State Store

Why are the changes needed?

For some streaming operators, using multiGet and deleteRange can improve the read/write performance.

Does this PR introduce any user-facing change?

No

How was this patch tested?

UT

Was this patch authored or co-authored using generative AI tooling?

No

val valuesList = db.multiGetAsList(readOptions, keysList)

// Convert to Array[Array[Byte]] in one line
valuesList.toArray(new Array[Array[Byte]](valuesList.size()))
Copy link
Contributor

Choose a reason for hiding this comment

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

This will invoke another copy ? can we leave it as java.util.List ?

colFamilyName: String = StateStore.DEFAULT_COL_FAMILY_NAME): UnsafeRow

def multiGet(keys: Array[UnsafeRow], colFamilyName: String): Iterator[UnsafeRow] = {
keys.iterator.map(key => get(key, colFamilyName))
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not just do the override in HDFSProvider for this ?

tryWithProviderResource(
newStoreProvider(
keySchemaWithRangeScan,
RangeKeyScanStateEncoderSpec(keySchemaWithRangeScan, Seq(0)),
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we enforce in the code that deleteRange will only work for range scan encoder ?

}
}

test("multiGet - batch retrieval of multiple keys") {
Copy link
Contributor

Choose a reason for hiding this comment

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

Lets add the test for HDFS provider also in case we plan to support it ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants