capacman opened a new pull request, #7875:
URL: https://github.com/apache/kyuubi/pull/7875

   ### Why are the changes needed?
   
   Closes #7874.
   
   A Kyuubi session's Spark session is created via `newSession()`, so it starts 
with the configs of the connection that launched the engine. Catalog plugins 
read `spark.sql.catalog.<name>.*` only once, in `initialize`. On session open, 
the initialize SQLs (`kyuubi.engine.session.initialize.sql`) and 
`use:catalog`/`use:database` ran before the session configs were applied. So a 
catalog touched by them, e.g. by `USE iceberg`, got the stale configs (such as 
the first connection's credentials) and ignored the ones the client passed.
   
   - `SparkSQLSessionManager.newSparkSession` now applies the session configs 
before it runs the initialize SQLs.
   - `SparkSessionImpl.open` now applies the session configs before switching 
catalog/database. It also makes the session active while switching, because 
`CatalogManager` reads configs via `SQLConf.get`.
   - `setModifiableConfig` moves to `KyuubiSparkUtil` so both places can call 
it.
   
   ### How was this patch tested?
   
   Added `SessionConfBeforeCatalogInitSuite`. It registers a catalog plugin 
that records the config it is initialized with, and checks that a session's own 
value wins over the engine-launch value, both through the initialize SQL and 
through `use:catalog`.
   
   ```
   build/mvn test -pl externals/kyuubi-spark-sql-engine -am -Dtest=none \
     -DwildcardSuites=org.apache.kyuubi.engine.spark.session
   ```
   
   ### Was this patch assisted by generative AI tooling?
   
   Assisted-by: Claude:claude-opus-5-5
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


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