HeartSaVioR commented on code in PR #54083:
URL: https://github.com/apache/spark/pull/54083#discussion_r2767424537
##########
sql/core/src/main/scala/org/apache/spark/sql/execution/streaming/state/RocksDB.scala:
##########
@@ -127,7 +127,18 @@ class RocksDB(
rocksDbOptions.setMaxOpenFiles(conf.maxOpenFiles)
rocksDbOptions.setAllowFAllocate(conf.allowFAllocate)
rocksDbOptions.setAvoidFlushDuringShutdown(true)
- rocksDbOptions.setMergeOperator(new StringAppendOperator())
+ // Set merge operator based on version for backward compatibility
+ // Version 1: comma delimiter ",", Version 2: empty string ""
+ val mergeDelimiter = conf.mergeOperatorVersion match {
+ case 1 => ","
+ case 2 => ""
+ case v => throw new IllegalArgumentException(
+ s"Invalid merge operator version: $v. Supported versions are 1 and 2")
+ }
+ rocksDbOptions.setMergeOperator(new StringAppendOperator(mergeDelimiter))
Review Comment:
It should be ',' vs "," and should be the same effect. There is a test
confirming like `merge("key1", "a") -> merge("key1", "b") -> get("key")` with
version 1 = "a,b" while with version 2 = "ab".
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]