Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SPARK-41524][SS] Differentiate SQLConf and extraOptions in StateStoreConf for its usage in RocksDBConf #39069

Closed
wants to merge 4 commits into from

Conversation

huanliwang-db
Copy link
Contributor

@huanliwang-db huanliwang-db commented Dec 15, 2022

What changes were proposed in this pull request?

Currently the usage of StateStoreConf is via confs, which composes both SQL confs and extraOptions into one. The name of config for extraOptions shouldn't have to follow the name prefix of SQL conf, because it's not bound to the context of SQL conf.

Why are the changes needed?

After differentiate SQL conf and extraOptions in StateStoreConf, we should be able to adopt more use case on operator level configs by using the extraOptions.

Does this PR introduce any user-facing change?

No

How was this patch tested?

Existing UT should cover the change


private case class ConfEntry(name: String, default: String) {
def fullName: String = s"$ROCKSDB_CONF_NAME_PREFIX.${name}".toLowerCase(Locale.ROOT)
def sqlConfFullName: String = s"$ROCKSDB_SQL_CONF_NAME_PREFIX.${name}".toLowerCase(Locale.ROOT)
def lowerCaseName: String = name.toLowerCase(Locale.ROOT)
Copy link
Contributor

Choose a reason for hiding this comment

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

What about having different class for each case instead? It would be clearer to distinguish configs, e.g. we don't expect the same config to be set from both SQL conf and extraOptions. If we allow such case, it'll be a bit more complicated than what you proposed, e.g. we will have to define preference.

Copy link
Contributor

Choose a reason for hiding this comment

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

After the change, the method name does not need additional FromSQL or FromExtraOptions since parameter will tell the fact.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@HeartSaVioR HeartSaVioR changed the title [SPARK-41524][SS] Differentiate SQLConf and extraOptions in StateStor… [SPARK-41524][SS] Differentiate SQLConf and extraOptions in StateStoreConf for its usage in RocksDBConf Dec 15, 2022
Copy link
Contributor

@HeartSaVioR HeartSaVioR left a comment

Choose a reason for hiding this comment

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

Thanks for the work! Only one comment.

@@ -560,21 +560,35 @@ case class RocksDBConf(

object RocksDBConf {
/** Common prefix of all confs in SQLConf that affects RocksDB */
val ROCKSDB_CONF_NAME_PREFIX = "spark.sql.streaming.stateStore.rocksdb"
val ROCKSDB_SQL_CONF_NAME_PREFIX = "spark.sql.streaming.stateStore.rocksdb"

private case class ConfEntry(name: String, default: String) {
Copy link
Contributor

Choose a reason for hiding this comment

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

abstract class or trait. extending case class is a bad practice for Scala.

EDIT: It's not just a bad practice. It's disallowed.

Copy link
Contributor

@HeartSaVioR HeartSaVioR left a comment

Choose a reason for hiding this comment

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

+1 pending CI.

@HeartSaVioR
Copy link
Contributor

Thanks! Merging to master.

@AmplabJenkins
Copy link

Can one of the admins verify this patch?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants