You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kyuubi.apache.org by ch...@apache.org on 2022/06/12 06:01:28 UTC

[incubator-kyuubi] branch master updated: [KYUUBI #2848] Global temp view should only exist in session catalog

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

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


The following commit(s) were added to refs/heads/master by this push:
     new 60b0cd186 [KYUUBI #2848] Global temp view should only exist in session catalog
60b0cd186 is described below

commit 60b0cd18692211b9ec878a90801abfcda7f3fd58
Author: Cheng Pan <ch...@apache.org>
AuthorDate: Sun Jun 12 14:01:18 2022 +0800

    [KYUUBI #2848] Global temp view should only exist in session catalog
    
    ### _Why are the changes needed?_
    
    DS v2 does not support view yet.
    <img width="1916" alt="image" src="https://user-images.githubusercontent.com/26535726/172974844-f1347cb0-ffcd-49fc-99f2-2669f8f945d1.png">
    
    ### _How was this patch tested?_
    - [ ] Add some test cases that check the changes thoroughly including negative and positive cases if possible
    
    - [ ] Add screenshots for manual tests if appropriate
    
    - [ ] [Run test](https://kyuubi.apache.org/docs/latest/develop_tools/testing.html#running-tests) locally before make a pull request
    
    Closes #2848 from pan3793/global_temp.
    
    Closes #2848
    
    4263131f [Cheng Pan] ut
    50a51590 [Cheng Pan] ut
    9e476c1e [Cheng Pan] Global temp view should only exist in session catalog
    
    Authored-by: Cheng Pan <ch...@apache.org>
    Signed-off-by: Cheng Pan <ch...@apache.org>
---
 .../org/apache/kyuubi/engine/spark/shim/CatalogShim_v3_0.scala   | 9 ++++++---
 .../scala/org/apache/kyuubi/operation/IcebergMetadataTests.scala | 4 ++--
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/externals/kyuubi-spark-sql-engine/src/main/scala/org/apache/kyuubi/engine/spark/shim/CatalogShim_v3_0.scala b/externals/kyuubi-spark-sql-engine/src/main/scala/org/apache/kyuubi/engine/spark/shim/CatalogShim_v3_0.scala
index e42d2cf33..d60f94ac7 100644
--- a/externals/kyuubi-spark-sql-engine/src/main/scala/org/apache/kyuubi/engine/spark/shim/CatalogShim_v3_0.scala
+++ b/externals/kyuubi-spark-sql-engine/src/main/scala/org/apache/kyuubi/engine/spark/shim/CatalogShim_v3_0.scala
@@ -129,10 +129,13 @@ class CatalogShim_v3_0 extends CatalogShim_v2_4 {
       spark: SparkSession,
       catalogName: String,
       schemaPattern: String): Seq[Row] = {
-    val viewMgr = getGlobalTempViewManager(spark, schemaPattern)
     val catalog = getCatalog(spark, catalogName)
-    val schemas = getSchemasWithPattern(catalog, schemaPattern)
-    (schemas ++ viewMgr).map(Row(_, catalog.name()))
+    var schemas = getSchemasWithPattern(catalog, schemaPattern)
+    if (catalogName == SparkCatalogShim.SESSION_CATALOG) {
+      val viewMgr = getGlobalTempViewManager(spark, schemaPattern)
+      schemas = schemas ++ viewMgr
+    }
+    schemas.map(Row(_, catalog.name))
   }
 
   override def setCurrentDatabase(spark: SparkSession, databaseName: String): Unit = {
diff --git a/kyuubi-common/src/test/scala/org/apache/kyuubi/operation/IcebergMetadataTests.scala b/kyuubi-common/src/test/scala/org/apache/kyuubi/operation/IcebergMetadataTests.scala
index 66540a982..04a524b44 100644
--- a/kyuubi-common/src/test/scala/org/apache/kyuubi/operation/IcebergMetadataTests.scala
+++ b/kyuubi-common/src/test/scala/org/apache/kyuubi/operation/IcebergMetadataTests.scala
@@ -50,7 +50,7 @@ trait IcebergMetadataTests extends HiveJDBCTestHelper with IcebergSuiteMixin {
         matchAllPatterns foreach { pattern =>
           checkGetSchemas(
             metaData.getSchemas(cg, pattern),
-            dbs ++ Seq("global_temp"),
+            dbs,
             catalog)
         }
       }
@@ -86,7 +86,7 @@ trait IcebergMetadataTests extends HiveJDBCTestHelper with IcebergSuiteMixin {
         matchAllPatterns foreach { pattern =>
           checkGetSchemas(
             metaData.getSchemas(cg, pattern),
-            dbs ++ Seq("global_temp", "a", "db1", "db1.db2"),
+            dbs ++ Seq("a", "db1", "db1.db2"),
             catalog)
         }
       }