### Why are the changes needed? <img width="1860" height="908" alt="image" src="https://github.com/user-attachments/assets/ec445237-be62-405f-992e-56e10156407f" /> **Current Behavior:** When "kyuubi.engine.share.level = USER/GROUP/SERVER", the first client (Client A) calling openSession creates a Kyuubi-Spark-SQL-Engine (Spark Driver), where the initialization SQL configured in "kyuubi.session.engine.spark.initialize.sql" takes effect. Subsequent clients (e.g., Client B) connecting via openSession will reuse the existing Kyuubi-Spark-SQL-Engine (Spark Driver) created in step 1, where the initialization SQL configured in "kyuubi.session.engine.spark.initialize.sql" becomes ineffective. **Why This Capability Is Needed:** Currently, kyuubi.session.engine.spark.initialize.sql only applies to the first openSession client. All subsequent SQL operations inherit the initialization SQL configuration from the first client (this appears to be a potential bug). Client A may need to set "USE dbA" in its current SQL context, while Client B may need "USE dbB" in its own context - such scenarios should be supported. ### How was this patch tested? Tested on local Kyuubi/Spark cluster. No existing unit tests cover this scenario. Please point me to any relevant tests so I can add them ### Was this patch authored or co-authored using generative AI tooling? No Closes #7138 from 1358035421/lc/spark_session_init_sql. Closes #7138 338d8aace [Cheng Pan] remove dash 1beecc456 [Cheng Pan] fix 6c7f9a13e [liangzhaoyuan] update migration-guide.md 492adb6c4 [liangzhaoyuan] fix review comments f0e9320be [1358035421] Merge branch 'master' into lc/spark_session_init_sql 021455322 [liangzhaoyuan] update migration-guide.md b4e61cf89 [liangzhaoyuan] ut ca4c71253 [Cheng Pan] Update externals/kyuubi-spark-sql-engine/src/main/scala/org/apache/kyuubi/engine/spark/session/SparkSQLSessionManager.scala da92544f1 [liangzhaoyuan] fix c1a38d584 [liangzhaoyuan] Support executing kyuubi.session.engine.spark.initialize.sql on session initialization Lead-authored-by: liangzhaoyuan <lwlzyl19940916@gmail.com> Co-authored-by: Cheng Pan <chengpan@apache.org> Co-authored-by: 1358035421 <13588035421@163.com> Co-authored-by: Cheng Pan <pan3793@gmail.com> Signed-off-by: Cheng Pan <chengpan@apache.org>
6.8 KiB
Kyuubi Migration Guide
Upgrading from Kyuubi 1.10 to 1.11
-
Since Kyuubi 1.11, the configuration
spark.sql.watchdog.forcedMaxOutputRowsprovided by Kyuubi Spark extension is removed, consider usingkyuubi.operation.result.max.rowsinstead. Note, the latter works without requirement of installing Kyuubi Spark extension. -
Since Kyuubi 1.11, if the engine is running in cluster mode, Kyuubi will respect the
kyuubi.session.engine.startup.waitCompletionconfig to determine whether to wait for the engine completion or not. If the engine is running in client mode, Kyuubi will always wait for the engine completion. And for Spark engine, Kyuubi will append thespark.yarn.submit.waitAppCompletionandspark.kubernetes.submission.waitAppCompletionconfigs to the engine conf based on the value ofkyuubi.session.engine.startup.waitCompletion. -
Since Kyuubi 1.11, the configuration
kyuubi.session.engine.spark.initialize.sqlset by the client (via session configuration) is now correctly applied to every session in shared engines (USER, GROUP, SERVER). Previously, only the value set on the server side was applied and only for the first session when the engine started. Now, session-level settings provided by each client are respected.
Upgrading from Kyuubi 1.9 to 1.10
- Since Kyuubi 1.10,
beelineis deprecated and will be removed in the future, please usekyuubi-beelineinstead. - Since Kyuubi 1.10, the support of Spark engine for Spark 3.1 is removed.
- Since Kyuubi 1.10, the support of Spark engine for Spark 3.2 is deprecated, and will be removed in the future.
- Since Kyuubi 1.10, the support of Flink engine for Flink 1.16 is removed.
Upgrading from Kyuubi 1.8 to 1.9
- Since Kyuubi 1.9,
kyuubi.session.conf.advisorcan be set as a sequence, Kyuubi supported chaining SessionConfAdvisors. - Since Kyuubi 1.9, the support of Derby is removal for Kyuubi metastore.
- Since Kyuubi 1.9, the support of Spark SQL engine for Spark 3.1 is deprecated, and will be removed in the future.
- Since Kyuubi 1.9, the support of Spark extensions for Spark 3.1 is removed, please use Spark 3.2 or higher versions.
- Since Kyuubi 1.9,
kyuubi.frontend.login.timeout,kyuubi.frontend.thrift.login.timeout,kyuubi.frontend.backoff.slot.length,kyuubi.frontend.thrift.backoff.slot.lengthare removed. - Since Kyuubi 1.9, the support of Flink engine for Flink 1.16 is deprecated, and will be removed in the future.
Upgrading from Kyuubi 1.8.0 to 1.8.1
- Since Kyuubi 1.8.1, for
DELETE /batches/${batchId},hive.server2.proxy.useris not needed in the request parameters. - Since Kyuubi 1.8.1, the default SQLite file
kyuubi_state_store.dbfor Metadata store is located under$KYUUBI_HOMEinstead of$PWD. To restore previous behavior, setkyuubi.metadata.store.jdbc.urltojdbc:sqlite:kyuubi_state_store.db.
Upgrading from Kyuubi 1.7 to 1.8
- Since Kyuubi 1.8, SQLite is added and becomes the default database type of Kyuubi metastore, as Derby has been deprecated.
Both Derby and SQLite are mainly for testing purposes, and they're not supposed to be used in production.
To restore previous behavior, set
kyuubi.metadata.store.jdbc.database.type=DERBYandkyuubi.metadata.store.jdbc.url=jdbc:derby:memory:kyuubi_state_store_db;create=true. - Since Kyuubi 1.8, if the directory of the embedded zookeeper configuration (
kyuubi.zookeeper.embedded.directory&kyuubi.zookeeper.embedded.data.dir&kyuubi.zookeeper.embedded.data.log.dir) is a relative path, it is resolved relative to$KYUUBI_HOMEinstead of$PWD. - Since Kyuubi 1.8, PROMETHEUS is changed as the default metrics reporter. To restore previous behavior,
set
kyuubi.metrics.reporters=JSON.
Upgrading from Kyuubi 1.7.1 to 1.7.2
- Since Kyuubi 1.7.2, for Kyuubi BeeLine, please use
--python-modeoption to run python code or script.
Upgrading from Kyuubi 1.7.0 to 1.7.1
- Since Kyuubi 1.7.1,
protocolVersionis removed from the request parameters of the REST APIOpen(create) a session. All removed or unknown parameters will be silently ignored and affects nothing. - Since Kyuubi 1.7.1,
confOverlayis supported in the request parameters of the REST APICreate an operation with EXECUTE_STATEMENT type.
Upgrading from Kyuubi 1.6 to 1.7
- In Kyuubi 1.7,
kyuubi.ha.zookeeper.engine.auth.typedoes not fallback tokyuubi.ha.zookeeper.auth.type.
When Kyuubi engine does Kerberos authentication with Zookeeper, user needs to explicitly setkyuubi.ha.zookeeper.engine.auth.typetoKERBEROS. - Since Kyuubi 1.7, Kyuubi returns engine's information for
GetInforequest instead of server. To restore the previous behavior, setkyuubi.server.info.providertoSERVER. - Since Kyuubi 1.7, Kyuubi session type
SQLis refactored toINTERACTIVE, because Kyuubi supports not onlySQLsession, but alsoSCALAandPYTHONsessions. User need to useINTERACTIVEsessionType to look up the session event. - Since Kyuubi 1.7, the REST API of
Open(create) a sessionwill not contain parametersuserpasswordandIpAddr. User and password should be set inAuthorizationof http request if needed.
Upgrading from Kyuubi 1.6.0 to 1.6.1
- Since Kyuubi 1.6.1,
kyuubi.ha.zookeeper.engine.auth.typedoes not fallback tokyuubi.ha.zookeeper.auth.type.
When Kyuubi engine does Kerberos authentication with Zookeeper, user needs to explicitly setkyuubi.ha.zookeeper.engine.auth.typetoKERBEROS.
Upgrading from Kyuubi 1.5 to 1.6
- Kyuubi engine gets Zookeeper principal & keytab from
kyuubi.ha.zookeeper.auth.principal&kyuubi.ha.zookeeper.auth.keytab.
kyuubi.ha.zookeeper.auth.principal&kyuubi.ha.zookeeper.auth.keytabfallback tokyuubi.kinit.principal&kyuubi.kinit.keytabwhen not set.
Since Kyuubi 1.6,kyuubi.kinit.principal&kyuubi.kinit.keytabare filtered out from Kyuubi engine's conf for better security.
When Kyuubi engine does Kerberos authentication with Zookeeper, user needs to explicitly setkyuubi.ha.zookeeper.auth.principal&kyuubi.ha.zookeeper.auth.keytab.