suhuruli opened a new pull request, #60579:
URL: https://github.com/apache/spark/pull/60579

   ### What changes were proposed in this pull request?
   
   When a flow runs, `SparkSessionUtils.withSqlConf` no longer sets SQL 
configurations that cannot change on a running session. These are static SQL 
configurations and Spark core configurations. If the requested value differs 
from the session's value, a warning is logged. Runtime configurations, and keys 
Spark does not register, are set and restored as before.
   
   - `sql/pipelines/.../util/SparkSessionUtils.scala`: `withSqlConf` splits its 
pairs into runtime and non-runtime keys. `SparkSessionUtils` now extends 
`Logging`.
   - `sql/pipelines/src/test/.../util/SparkSessionUtilsSuite.scala` (new): one 
test checks that runtime configurations are set for the block and restored 
after it. A second test checks that static and core configurations keep the 
session's value while a runtime configuration is still applied.
   - `sql/pipelines/src/test/.../graph/TriggeredGraphExecutionSuite.scala`: a 
new test runs a pipeline whose default SQL configuration includes a static SQL 
configuration at its current value and `spark.driver.memory`. Its flows 
complete and the output rows are correct.
   
   
   ### Why are the changes needed?
   
   The `spark-pipelines` CLI passes the spec's `configuration` to Spark twice. 
It sets the entries on the session builder, which works when the session 
starts. It also sends the same map to the pipeline graph as its default SQL 
configuration, and the graph applies that map to every flow.
   
   Setting a static SQL configuration, such as 
`spark.sql.catalogImplementation`, or a Spark core configuration, such as 
`spark.driver.memory`, on a running session throws. So every flow failed with 
`CANNOT_MODIFY_STATIC_CONFIG` or `CANNOT_MODIFY_CONFIG`, even when the spec's 
value matched the session.
   
   ### Does this PR introduce _any_ user-facing change?
   
   Yes. Static and core configurations in a pipeline's `configuration`, and in 
a flow's own settings, no longer fail flows. When the requested value differs 
from the session's value, the flow runs with the session's value and the driver 
log has a warning. Before, the flow failed. Runtime configurations behave as 
before.
   
   ### How was this patch tested?
   
   - I added `SparkSessionUtilsSuite` (two tests) and the 
`TriggeredGraphExecutionSuite` test "pipeline-level confs that cannot be 
modified at runtime do not fail flows". Both fail without this change. I ran 
them with `build/sbt "pipelines/testOnly *SparkSessionUtilsSuite 
*TriggeredGraphExecutionSuite"`.
   - I ran Scalastyle for the pipelines module (main and test); it passes.
   - I did not add a test that runs through the `spark-pipelines` command, and 
no test checks the warning text.
   
   ### Was this patch authored or co-authored using generative AI tooling?
   
   Generated-by: Claude Opus 5.5
   


-- 
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]

Reply via email to