This is an automated email from the ASF dual-hosted git repository.

chengpan pushed a commit to branch branch-1.7
in repository https://gitbox.apache.org/repos/asf/kyuubi.git


The following commit(s) were added to refs/heads/branch-1.7 by this push:
     new ef1a6f586 [KYUUBI #4915] Adapt database not exist error message change 
for Spark 3.4
ef1a6f586 is described below

commit ef1a6f58641c29673c72c10311065c0fd7bf94aa
Author: Cheng Pan <[email protected]>
AuthorDate: Thu Jun 1 13:47:37 2023 +0800

    [KYUUBI #4915] Adapt database not exist error message change for Spark 3.4
    
    Spark is migrating to the error class framework, in SPARK-40360(fixed in 
3.4.0) SCHEMA_NOT_FOUND was introduced, which changes the output of the error 
message on switching a not existing database.
    
    - [ ] Add some test cases that check the changes thoroughly including 
negative and positive cases if possible
    
    - [ ] Add screenshots for manual tests if appropriate
    
    - [x] [Run 
test](https://kyuubi.readthedocs.io/en/master/develop_tools/testing.html#running-tests)
 locally before make a pull request
    
    Closes #4915 from pan3793/schema-not-found.
    
    Closes #4915
    
    c0e03feaf [Cheng Pan] nit
    0ee0deada [Cheng Pan] SCHEMA_NOT_FOUND
    
    Authored-by: Cheng Pan <[email protected]>
    Signed-off-by: Cheng Pan <[email protected]>
    (cherry picked from commit 00b32a0381217130bc9b2c6da04f4f913fcba189)
    Signed-off-by: Cheng Pan <[email protected]>
---
 .../org/apache/kyuubi/engine/spark/session/SparkSessionImpl.scala | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git 
a/externals/kyuubi-spark-sql-engine/src/main/scala/org/apache/kyuubi/engine/spark/session/SparkSessionImpl.scala
 
b/externals/kyuubi-spark-sql-engine/src/main/scala/org/apache/kyuubi/engine/spark/session/SparkSessionImpl.scala
index 96fc43e85..b078806d7 100644
--- 
a/externals/kyuubi-spark-sql-engine/src/main/scala/org/apache/kyuubi/engine/spark/session/SparkSessionImpl.scala
+++ 
b/externals/kyuubi-spark-sql-engine/src/main/scala/org/apache/kyuubi/engine/spark/session/SparkSessionImpl.scala
@@ -17,6 +17,7 @@
 
 package org.apache.kyuubi.engine.spark.session
 
+import org.apache.commons.lang3.StringUtils
 import org.apache.hive.service.rpc.thrift.{TGetInfoType, TGetInfoValue, 
TProtocolVersion}
 import org.apache.spark.sql.{AnalysisException, SparkSession}
 
@@ -27,8 +28,7 @@ import 
org.apache.kyuubi.engine.spark.operation.SparkSQLOperationManager
 import org.apache.kyuubi.engine.spark.shim.SparkCatalogShim
 import org.apache.kyuubi.engine.spark.udf.KDFRegistry
 import org.apache.kyuubi.events.EventBus
-import org.apache.kyuubi.operation.{Operation, OperationHandle}
-import org.apache.kyuubi.session.{AbstractSession, SessionHandle, 
SessionManager}
+import org.apache.kyuubi.session._
 
 class SparkSessionImpl(
     protocol: TProtocolVersion,
@@ -73,8 +73,8 @@ class SparkSessionImpl(
         SparkCatalogShim().setCurrentDatabase(spark, database)
       } catch {
         case e
-            if database == "default" && e.getMessage != null &&
-              e.getMessage.contains("not found") =>
+            if database == "default" &&
+              StringUtils.containsAny(e.getMessage, "not found", 
"SCHEMA_NOT_FOUND") =>
       }
     }
 

Reply via email to