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 78b751616 [KYUUBI #4952] Enhance AWS Glue default database does not 
exist error message on opening session
78b751616 is described below

commit 78b7516161701933694c93a94f1eb95f3a8a4bdb
Author: pengqli <[email protected]>
AuthorDate: Tue Jun 13 14:09:37 2023 +0800

    [KYUUBI #4952] Enhance AWS Glue default database does not exist error 
message on opening session
    
    ### _Why are the changes needed?_
    
    When the default databases of glue do not exist, initializing the engine 
session failed.
    ```
    Caused by: 
software.amazon.awssdk.services.glue.model.AccessDeniedException: User: 
arn:aws:iam::xxxxx:user/vault-token-wap-udp-int-readwrite-1686560253-eVgl3oauuaB7v0V6wX9
 is not authorized to perform: glue:GetDatabase on resource: 
arn:aws:glue:us-east-1:xxxxx:database/default because no identity-based policy 
allows the glue:GetDatabase action (Service: Glue, Status Code: 400, Request 
ID: 3f816608-0cb2-467b-9181-05c5bfcd29b3, Extended Request ID: null)
    ```
    
![image](https://github.com/apache/kyuubi/assets/43336508/a0e9ccac-7fdb-4036-a4f3-2885d7bd0ac5)
    
    The default initialize sql "SHOW DATABASES" when Kyuubi spark accesses the 
glue catalog. Try to change the initialize sql "use glue.wap" has the same 
error.
    ```
    kyuubi.engine.initialize.sql=use glue.wap
    kyuubi.engine.session.initialize.sql=use glue.wap
    ```
    The root cause is that hive defines a use:database, which will initialize 
access to the database default.
    
    ### _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
    
    - [x] [Run 
test](https://kyuubi.readthedocs.io/en/master/develop_tools/testing.html#running-tests)
 locally before make a pull request
    
    Closes #4952 from dev-lpq/glue_database.
    
    Closes #4952
    
    8f0951d4d [pengqli] add Glue database
    90e47712f [pengqli] enhance AWS Glue database
    
    Authored-by: pengqli <[email protected]>
    Signed-off-by: Cheng Pan <[email protected]>
    (cherry picked from commit cca4405fcb581e6b8dd3f3cbd8ab55c278045113)
    Signed-off-by: Cheng Pan <[email protected]>
---
 .../org/apache/kyuubi/engine/spark/session/SparkSessionImpl.scala   | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

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 e50e111cb..95aa84635 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
@@ -75,7 +75,11 @@ class SparkSessionImpl(
       } catch {
         case e
             if database == "default" &&
-              StringUtils.containsAny(e.getMessage, "not found", 
"SCHEMA_NOT_FOUND") =>
+              StringUtils.containsAny(
+                e.getMessage,
+                "not found",
+                "SCHEMA_NOT_FOUND",
+                "is not authorized to perform: glue:GetDatabase") =>
       }
     }
 

Reply via email to