Skip to content

Conversation

@hvanhovell
Copy link
Contributor

What changes were proposed in this pull request?

This PR introduces a configuration system for classes that are in sql/api.

Why are the changes needed?

We are moving a number of components into sql/api that rely on confs being set when used with sql/core. The conf system added here gives us that flexibility to do so.

Does this PR introduce any user-facing change?

No.

How was this patch tested?

Existing tests.

@github-actions github-actions bot added the SQL label Jul 3, 2023
* See [[get]] for more information.
*/
def setSQLConfGetter(getter: () => SQLConf): Unit = {
SqlApiConf.setConfGetter(getter)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is just a bit more efficient.

* Check if `this` and `other` are the same data type when ignoring nullability
* (`StructField.nullable`, `ArrayType.containsNull`, and `MapType.valueContainsNull`).
*/
def sameType(left: DataType, right: DataType): Boolean =
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We should move this back to DataType.

Copy link
Contributor

Choose a reason for hiding this comment

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

sure we should do it.

@hvanhovell
Copy link
Contributor Author

cc @amaliujia

* then it values are bound to the currently set SQLConf. In connect mode it will default to
* hardcoded values.
*/
private[sql] trait SqlApiConf {
Copy link
Member

Choose a reason for hiding this comment

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

no biggie and just dropping a comment. I wonder if we should name it like just SQLConfiguration or just SQLConf (since org.apache.spark.sql.internal.SQLConf at sql/core isn't API anyway)

Copy link
Contributor

Choose a reason for hiding this comment

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

Probably not name as SQLConf, as that will triggers a huge amount of refactorings.

Copy link
Member

Choose a reason for hiding this comment

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

Is org.apache.spark.SparkConf a public API? How about naming it SparkSQLConf?

Copy link
Member

Choose a reason for hiding this comment

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

SparkSQLConf SGTM

Copy link
Contributor

Choose a reason for hiding this comment

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

SparkSQLConf SGTM

+1

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It really should be an internal thing. It is marked private[sql] for this reason. Users should only interact with RuntimeConf, and perhaps SparkSession.Builder to get/set options.

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, if it's internal, I am good with whatever name :-)

Copy link
Contributor

@amaliujia amaliujia left a comment

Choose a reason for hiding this comment

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

LGTM. Only see other people have some minor comments. Should be good once those comments are addressed.

@hvanhovell
Copy link
Contributor Author

Merging.

@hvanhovell hvanhovell closed this in 1fbb94b Jul 6, 2023
def get: SqlApiConf = confGetter.get()()

// Force load SQLConf. This will trigger the installation of a confGetter that points to SQLConf.
Try(SparkClassUtils.classForName("org.apache.spark.sql.internal.SQLConf$"))
Copy link
Member

@turboFei turboFei Dec 19, 2024

Choose a reason for hiding this comment

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

Hi @hvanhovell We meet dead lock issue in a iceberg compaction job and seems related with this patch.

I have raised ticket https://issues.apache.org/jira/browse/SPARK-50620 and provide the thread dump: https://issues.apache.org/jira/secure/attachment/13073575/iceberg_compaction.txt

"Executor 92 task launch worker for task 2910, task 69.0 in stage 7.0 (TID 2910)" #152 daemon prio=5 os_prio=0 cpu=616.25ms elapsed=258408.34s tid=0x00007f77d67cc330 nid=0x22c9e in Object.wait()  [0x00007f77755fb000]
   java.lang.Thread.State: RUNNABLE
	at org.apache.spark.sql.internal.SQLConf$.<init>(SQLConf.scala:184)
	- waiting on the Class initialization monitor for org.apache.spark.sql.internal.SqlApiConf$
	at org.apache.spark.sql.internal.SQLConf$.<clinit>(SQLConf.scala)
"Executor 92 task launch worker for task 5362, task 521.0 in stage 10.0 (TID 5362)" #123 daemon prio=5 os_prio=0 cpu=2443.78ms elapsed=258409.29s tid=0x00007f77d60ecad0 nid=0x22c7c in Object.wait()  [0x00007f777e591000]
   java.lang.Thread.State: RUNNABLE
	at java.lang.Class.forName0([email protected]/Native Method)
	- waiting on the Class initialization monitor for org.apache.spark.sql.internal.SQLConf$
	at java.lang.Class.forName([email protected]/Class.java:467)
	at org.apache.spark.util.SparkClassUtils.classForName(SparkClassUtils.scala:41)
	at org.apache.spark.util.SparkClassUtils.classForName$(SparkClassUtils.scala:36)
	at org.apache.spark.util.SparkClassUtils$.classForName(SparkClassUtils.scala:83)
	at org.apache.spark.sql.internal.SqlApiConf$.$anonfun$new$1(SqlApiConf.scala:73)

For the first task: at org.apache.spark.sql.internal.SQLConf$.<clinit>(SQLConf.scala) - waiting on the Class initialization monitor for org.apache.spark.sql.internal.SqlApiConf$.

For the second one: at org.apache.spark.sql.internal.SqlApiConf$.$anonfun$new$1(SqlApiConf.scala:73) - waiting on the Class initialization monitor for org.apache.spark.sql.internal.SQLConf$

Copy link
Member

Choose a reason for hiding this comment

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

resolved by #44602, please ignore

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants