Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[KYUUBI #4522] use:catalog should execute before than use:database #4648

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,12 @@ class FlinkSessionImpl(

override def open(): Unit = {
executor.openSession(handle.identifier.toString)
normalizedConf.get("use:catalog") match {

val (useCatalogAndDatabaseConf, otherConf) = normalizedConf.partition { case (k, _) =>
Array("use:catalog", "use:database").contains(k)
}

useCatalogAndDatabaseConf.get("use:catalog") match {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
useCatalogAndDatabaseConf.get("use:catalog") match {
useCatalogAndDatabaseConf.get("use:catalog").foreach { catalog =>
...

case Some(catalog) =>
val tableEnv = sessionContext.getExecutionContext.getTableEnvironment
try {
Expand All @@ -69,7 +74,7 @@ class FlinkSessionImpl(
case None =>
}

normalizedConf.get("use:database") match {
useCatalogAndDatabaseConf.get("use:database") match {
case Some(database) =>
val tableEnv = sessionContext.getExecutionContext.getTableEnvironment
try {
Expand All @@ -82,7 +87,8 @@ class FlinkSessionImpl(
}
case None =>
}
normalizedConf.filterKeys(key => !Set("use:catalog", "use:database").contains(key)).foreach {

otherConf.foreach {
case (key, value) => setModifiableConfig(key, value)
}
super.open()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,12 @@ class SparkSessionImpl(
private val sessionEvent = SessionEvent(this)

override def open(): Unit = {
normalizedConf.get("use:catalog") match {

val (useCatalogAndDatabaseConf, otherConf) = normalizedConf.partition { case (k, _) =>
Array("use:catalog", "use:database").contains(k)
}

useCatalogAndDatabaseConf.get("use:catalog") match {
case Some(catalog) =>
try {
SparkCatalogShim().setCurrentCatalog(spark, catalog)
Expand All @@ -65,7 +70,7 @@ class SparkSessionImpl(
case None =>
}

normalizedConf.get("use:database") match {
useCatalogAndDatabaseConf.get("use:database") match {
case Some(database) =>
try {
SparkCatalogShim().setCurrentDatabase(spark, database)
Expand All @@ -77,7 +82,7 @@ class SparkSessionImpl(
case None =>
}

normalizedConf.filterKeys(key => !Set("use:catalog", "use:database").contains(key)).foreach {
otherConf.foreach {
case (key, value) => setModifiableConfig(key, value)
}
KDFRegistry.registerAll(spark)
Expand Down