Skip to content

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

Closed
huanliwang-db wants to merge 4 commits intoapache:masterfrom
huanliwang-db:SPARK-41524
Closed

[SPARK-41524][SS] Differentiate SQLConf and extraOptions in StateStoreConf for its usage in RocksDBConf#39069
huanliwang-db wants to merge 4 commits intoapache:masterfrom
huanliwang-db:SPARK-41524

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

@HeartSaVioR HeartSaVioR Dec 15, 2022

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

@HeartSaVioR HeartSaVioR Dec 15, 2022

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.

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

@HeartSaVioR HeartSaVioR Dec 15, 2022

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

Development

Successfully merging this pull request may close these issues.

3 participants