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

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


The following commit(s) were added to refs/heads/branch-1.1-lts by this push:
     new e25899eb2e FIX: ctas string as first column (#15233)
e25899eb2e is described below

commit e25899eb2e0799b23b2066b73c84148af8f0663a
Author: Stalary <stal...@163.com>
AuthorDate: Fri Dec 23 09:37:36 2022 +0800

    FIX: ctas string as first column (#15233)
---
 fe/fe-core/src/main/java/org/apache/doris/catalog/Catalog.java | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/fe/fe-core/src/main/java/org/apache/doris/catalog/Catalog.java 
b/fe/fe-core/src/main/java/org/apache/doris/catalog/Catalog.java
index 1f94ae0559..603298dcaf 100755
--- a/fe/fe-core/src/main/java/org/apache/doris/catalog/Catalog.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/catalog/Catalog.java
@@ -3141,6 +3141,16 @@ public class Catalog {
                 } else {
                     typeDef = new TypeDef(resultExpr.getType());
                 }
+                if (i == 0) {
+                    // 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 unsupported types, just remain unchanged, the 
analysis phash of create table stmt
+                    // will handle it.
+                    if (typeDef.getType().getPrimitiveType() == 
PrimitiveType.STRING) {
+                        typeDef = 
TypeDef.createVarchar(ScalarType.MAX_VARCHAR_LENGTH);
+                    }
+                }
                 ColumnDef columnDef;
                 if (resultExpr.getSrcSlotRef() == null) {
                     columnDef = new ColumnDef(name, typeDef, false, null, 
true, new DefaultValue(false, null), "");


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

Reply via email to