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

warren pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git


The following commit(s) were added to refs/heads/main by this push:
     new 5f083cc3 fix: add quote in starrocks create table sql to prevent 
keyword conflict
5f083cc3 is described below

commit 5f083cc34f4a96b7571406cd8a957bffeae859ab
Author: Jinlong Peng <[email protected]>
AuthorDate: Wed Aug 10 19:28:21 2022 +0800

    fix: add quote in starrocks create table sql to prevent keyword conflict
---
 plugins/starrocks/tasks.go | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/plugins/starrocks/tasks.go b/plugins/starrocks/tasks.go
index 5a85b96e..4f776f65 100644
--- a/plugins/starrocks/tasks.go
+++ b/plugins/starrocks/tasks.go
@@ -6,7 +6,7 @@ The ASF licenses this file to You under the Apache License, 
Version 2.0
 (the "License"); you may not use this file except in compliance with
 the License.  You may obtain a copy of the License at
 
-    http://www.apache.org/licenses/LICENSE-2.0
+       http://www.apache.org/licenses/LICENSE-2.0
 
 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
@@ -105,7 +105,7 @@ func createTable(starrocks *sql.DB, db dal.Dal, 
starrocksTable string, table str
                if !ok {
                        return fmt.Errorf("Get [%s] ColumeType Failed", name)
                }
-               column := fmt.Sprintf("%s %s", name, 
getDataType(starrocksDatatype))
+               column := fmt.Sprintf("`%s` %s", name, 
getDataType(starrocksDatatype))
                columns = append(columns, column)
                isPrimaryKey, ok := cm.PrimaryKey()
                if isPrimaryKey && ok {
@@ -126,7 +126,7 @@ func createTable(starrocks *sql.DB, db dal.Dal, 
starrocksTable string, table str
        if extra == "" {
                extra = fmt.Sprintf(`engine=olap distributed by hash(%s) 
properties("replication_num" = "1")`, pks)
        }
-       tableSql := fmt.Sprintf(`create table if not exists %s ( %s ) %s`, 
starrocksTable, strings.Join(columns, ","), extra)
+       tableSql := fmt.Sprintf("create table if not exists `%s` ( %s ) %s", 
starrocksTable, strings.Join(columns, ","), extra)
        c.GetLogger().Info(tableSql)
        _, err = starrocks.Exec(tableSql)
        return err

Reply via email to