HyukjinKwon commented on code in PR #37196:
URL: https://github.com/apache/spark/pull/37196#discussion_r921698454
##########
sql/core/src/test/scala/org/apache/spark/sql/execution/streaming/state/RocksDBSuite.scala:
##########
@@ -472,6 +472,56 @@ class RocksDBSuite extends SparkFunSuite {
}
}
+ // Add tests to check valid and invalid values for max_open_files passed to
the underlying
+ // RocksDB instance.
+ Seq("-1", "100", "1000").foreach { maxOpenFiles =>
+ test(s"SPARK-39781: adding valid max_open_files=$maxOpenFiles config
property " +
+ "for RocksDB state store instance should succeed") {
+ withTempDir { dir =>
+ val sqlConf = new SQLConf()
+
sqlConf.setConfString("spark.sql.streaming.stateStore.rocksdb.maxOpenFiles",
maxOpenFiles)
+ val dbConf = RocksDBConf(StateStoreConf(sqlConf))
+ assert(dbConf.maxOpenFiles === maxOpenFiles.toInt)
+
+ val remoteDir = dir.getCanonicalPath
+ withDB(remoteDir, conf = dbConf) { db =>
+ // Do some DB ops
+ db.load(0)
+ db.put("a", "1")
+ db.commit()
+ assert(toStr(db.get("a")) === "1")
+ }
+ }
+ }
+ }
+
+ Seq("test", "true").foreach { maxOpenFiles =>
+ test(s"SPARK-39781: adding invalid max_open_files=$maxOpenFiles config
property " +
+ "for RocksDB state store instance should fail") {
+ withTempDir { dir =>
+ val ex = intercept[Exception] {
Review Comment:
Let's catch more specific exception.
##########
sql/core/src/test/scala/org/apache/spark/sql/execution/streaming/state/RocksDBSuite.scala:
##########
@@ -472,6 +472,56 @@ class RocksDBSuite extends SparkFunSuite {
}
}
+ // Add tests to check valid and invalid values for max_open_files passed to
the underlying
+ // RocksDB instance.
+ Seq("-1", "100", "1000").foreach { maxOpenFiles =>
+ test(s"SPARK-39781: adding valid max_open_files=$maxOpenFiles config
property " +
+ "for RocksDB state store instance should succeed") {
+ withTempDir { dir =>
+ val sqlConf = new SQLConf()
+
sqlConf.setConfString("spark.sql.streaming.stateStore.rocksdb.maxOpenFiles",
maxOpenFiles)
+ val dbConf = RocksDBConf(StateStoreConf(sqlConf))
+ assert(dbConf.maxOpenFiles === maxOpenFiles.toInt)
+
+ val remoteDir = dir.getCanonicalPath
+ withDB(remoteDir, conf = dbConf) { db =>
+ // Do some DB ops
+ db.load(0)
+ db.put("a", "1")
+ db.commit()
+ assert(toStr(db.get("a")) === "1")
+ }
+ }
+ }
+ }
+
+ Seq("test", "true").foreach { maxOpenFiles =>
+ test(s"SPARK-39781: adding invalid max_open_files=$maxOpenFiles config
property " +
+ "for RocksDB state store instance should fail") {
+ withTempDir { dir =>
+ val ex = intercept[Exception] {
+ val sqlConf = new SQLConf()
Review Comment:
`SQLConf.get`?
--
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]