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

yiguolei pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/master by this push:
     new 8c5c6d9d7f [fix](ctas) fix wrong string column length after executing 
ctas from external table  (#14090)
8c5c6d9d7f is described below

commit 8c5c6d9d7fd24f7cbfc3ee74cdaeb46cc6c3a05d
Author: Mingyu Chen <morning...@163.com>
AuthorDate: Thu Nov 10 11:36:56 2022 +0800

    [fix](ctas) fix wrong string column length after executing ctas from 
external table  (#14090)
---
 .../java/org/apache/doris/catalog/HiveMetaStoreClientHelper.java    | 2 +-
 .../src/main/java/org/apache/doris/datasource/InternalCatalog.java  | 6 +++---
 .../main/java/org/apache/doris/external/elasticsearch/EsUtil.java   | 2 +-
 regression-test/suites/rollup_p0/test_rollup_agg_date.groovy        | 2 +-
 4 files changed, 6 insertions(+), 6 deletions(-)

diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/catalog/HiveMetaStoreClientHelper.java
 
b/fe/fe-core/src/main/java/org/apache/doris/catalog/HiveMetaStoreClientHelper.java
index 8440b5e6a2..ad9e6ed037 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/catalog/HiveMetaStoreClientHelper.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/catalog/HiveMetaStoreClientHelper.java
@@ -771,7 +771,7 @@ public class HiveMetaStoreClientHelper {
                 return Type.DOUBLE;
             case "string":
             case "binary":
-                return Type.STRING;
+                return ScalarType.createStringType();
             default:
                 break;
         }
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/datasource/InternalCatalog.java 
b/fe/fe-core/src/main/java/org/apache/doris/datasource/InternalCatalog.java
index 6bfec923e2..241de273eb 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/datasource/InternalCatalog.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/datasource/InternalCatalog.java
@@ -98,6 +98,7 @@ import org.apache.doris.catalog.Partition;
 import org.apache.doris.catalog.PartitionInfo;
 import org.apache.doris.catalog.PartitionItem;
 import org.apache.doris.catalog.PartitionType;
+import org.apache.doris.catalog.PrimitiveType;
 import org.apache.doris.catalog.RangePartitionItem;
 import org.apache.doris.catalog.Replica;
 import org.apache.doris.catalog.Replica.ReplicaState;
@@ -1206,7 +1207,6 @@ public class InternalCatalog implements 
CatalogIf<Database> {
                 Expr resultExpr = resultExprs.get(i);
                 Type resultType = resultExpr.getType();
                 if (resultType.isStringType() && resultType.getLength() < 0) {
-                    // alway set text length MAX_STRING_LENGTH
                     typeDef = new TypeDef(ScalarType.createStringType());
                 } else if (resultType.isDecimalV2() && 
resultType.equals(ScalarType.DECIMALV2)) {
                     typeDef = new TypeDef(ScalarType.createDecimalType(27, 9));
@@ -1220,9 +1220,9 @@ public class InternalCatalog implements 
CatalogIf<Database> {
                     // If this is the first column, because olap table does 
not support the first column to be
                     // string, float, double or array, we should check and 
modify its type
                     // For string type, change it to varchar.
-                    // For other unsupport types, just remain unchanged, the 
analysis phash of create table stmt
+                    // For other unsupported types, just remain unchanged, the 
analysis phash of create table stmt
                     // will handle it.
-                    if (typeDef.getType() == Type.STRING) {
+                    if (typeDef.getType().getPrimitiveType() == 
PrimitiveType.STRING) {
                         typeDef = 
TypeDef.createVarchar(ScalarType.MAX_VARCHAR_LENGTH);
                     }
                 }
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/external/elasticsearch/EsUtil.java 
b/fe/fe-core/src/main/java/org/apache/doris/external/elasticsearch/EsUtil.java
index cbf827b429..42a646face 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/external/elasticsearch/EsUtil.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/external/elasticsearch/EsUtil.java
@@ -416,7 +416,7 @@ public class EsUtil {
             case "nested":
             case "object":
             default:
-                return Type.STRING;
+                return ScalarType.createStringType();
         }
     }
 
diff --git a/regression-test/suites/rollup_p0/test_rollup_agg_date.groovy 
b/regression-test/suites/rollup_p0/test_rollup_agg_date.groovy
index 66be9074f0..40f1313c41 100644
--- a/regression-test/suites/rollup_p0/test_rollup_agg_date.groovy
+++ b/regression-test/suites/rollup_p0/test_rollup_agg_date.groovy
@@ -54,7 +54,7 @@ suite("test_rollup_agg_date", "rollup") {
             }
         }
     }
-    Thread.sleep(200)
+    Thread.sleep(2000)
     sql "ALTER TABLE ${tbName} ADD COLUMN datetimev4 datetimev2(3) MAX NULL;"
     max_try_secs = 60
     while (max_try_secs--) {


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to