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

englefly 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 8eaf0d3a4b [fix](Nereids) ctas varchar length should set to max except 
column from slot (#25003)
8eaf0d3a4b is described below

commit 8eaf0d3a4bd6739b931917f40f1507e5a1cf4ce1
Author: morrySnow <101034200+morrys...@users.noreply.github.com>
AuthorDate: Thu Sep 28 08:32:33 2023 -0500

    [fix](Nereids) ctas varchar length should set to max except column from 
slot (#25003)
---
 .../doris/nereids/trees/plans/commands/CreateTableCommand.java      | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/CreateTableCommand.java
 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/CreateTableCommand.java
index 43e3b0ce64..0e8782c8a5 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/CreateTableCommand.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/CreateTableCommand.java
@@ -41,6 +41,7 @@ import org.apache.doris.nereids.types.DataType;
 import org.apache.doris.nereids.types.DecimalV2Type;
 import org.apache.doris.nereids.types.TinyIntType;
 import org.apache.doris.nereids.types.VarcharType;
+import org.apache.doris.nereids.types.coercion.CharacterType;
 import org.apache.doris.qe.ConnectContext;
 import org.apache.doris.qe.QueryState.MysqlStateType;
 import org.apache.doris.qe.StmtExecutor;
@@ -106,6 +107,11 @@ public class CreateTableCommand extends Command implements 
ForwardWithSync {
                 dataType = DecimalV2Type.SYSTEM_DEFAULT;
             } else if (i == 0 && dataType.isStringType()) {
                 dataType = 
VarcharType.createVarcharType(ScalarType.MAX_VARCHAR_LENGTH);
+            } else if (dataType instanceof CharacterType) {
+                // if column is not come from column, we should set varchar 
length to max
+                if (((CharacterType) dataType).getLen() > 0 && 
!s.isColumnFromTable()) {
+                    dataType = 
VarcharType.createVarcharType(ScalarType.MAX_VARCHAR_LENGTH);
+                }
             }
             // if the column is an expression, we set it to nullable, 
otherwise according to the nullable of the slot.
             columnsOfQuery.add(new ColumnDefinition(s.getName(), dataType, 
!s.isColumnFromTable() || s.nullable()));


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

Reply via email to