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/11/29 04:40:19 UTC

[incubator-kyuubi] branch branch-1.6 updated: [KYUUBI #3867] Init SQL scripts should create table iff table does not exist

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

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


The following commit(s) were added to refs/heads/branch-1.6 by this push:
     new 325668325 [KYUUBI #3867] Init SQL scripts should create table iff table does not exist
325668325 is described below

commit 325668325b30c5e711dc207cc7e4f5aba35a90d7
Author: Cheng Pan <ch...@apache.org>
AuthorDate: Tue Nov 29 12:39:47 2022 +0800

    [KYUUBI #3867] Init SQL scripts should create table iff table does not exist
    
    ### _Why are the changes needed?_
    
    ### _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 #3867 from pan3793/sql.
    
    Closes #3867
    
    b3105b5f [Cheng Pan] derby
    8ed271a6 [Cheng Pan] Init SQL scripts should create table iff table does not exist
    
    Authored-by: Cheng Pan <ch...@apache.org>
    Signed-off-by: Cheng Pan <ch...@apache.org>
    (cherry picked from commit 496b3ee595b2402e4fdd16f30e73402b4997ce92)
    Signed-off-by: Cheng Pan <ch...@apache.org>
---
 .../src/main/resources/sql/derby/metadata-store-schema-derby.sql        | 2 ++
 .../src/main/resources/sql/mysql/metadata-store-schema-mysql.sql        | 2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/kyuubi-server/src/main/resources/sql/derby/metadata-store-schema-derby.sql b/kyuubi-server/src/main/resources/sql/derby/metadata-store-schema-derby.sql
index ecf41d6ab..ca19dfdbe 100644
--- a/kyuubi-server/src/main/resources/sql/derby/metadata-store-schema-derby.sql
+++ b/kyuubi-server/src/main/resources/sql/derby/metadata-store-schema-derby.sql
@@ -1,3 +1,5 @@
+-- Derby does not support `CREATE TABLE IF NOT EXISTS`
+
 -- the metadata table ddl
 
 CREATE TABLE metadata(
diff --git a/kyuubi-server/src/main/resources/sql/mysql/metadata-store-schema-mysql.sql b/kyuubi-server/src/main/resources/sql/mysql/metadata-store-schema-mysql.sql
index 4efddaa92..2396df33c 100644
--- a/kyuubi-server/src/main/resources/sql/mysql/metadata-store-schema-mysql.sql
+++ b/kyuubi-server/src/main/resources/sql/mysql/metadata-store-schema-mysql.sql
@@ -1,6 +1,6 @@
 -- the metadata table ddl
 
-CREATE TABLE metadata(
+CREATE TABLE IF NOT EXISTS metadata(
     key_id bigint PRIMARY KEY AUTO_INCREMENT COMMENT 'the auto increment key id',
     identifier varchar(36) NOT NULL COMMENT 'the identifier id, which is an UUID',
     session_type varchar(128) NOT NULL COMMENT 'the session type, SQL or BATCH',