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

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


The following commit(s) were added to refs/heads/branch-2.0 by this push:
     new 38dd009c380 [opt](Planner) convert varchar column to string when ctas 
from external table (#34103)
38dd009c380 is described below

commit 38dd009c38048d0af473527e4f97701ca98e3671
Author: morrySnow <101034200+morrys...@users.noreply.github.com>
AuthorDate: Fri Apr 26 07:21:28 2024 +0800

    [opt](Planner) convert varchar column to string when ctas from external 
table (#34103)
---
 .../src/main/java/org/apache/doris/datasource/InternalCatalog.java   | 5 +++++
 .../data/external_table_p0/jdbc/test_mysql_jdbc_catalog.out          | 4 ++--
 regression-test/data/external_table_p0/jdbc/test_pg_jdbc_catalog.out | 2 +-
 3 files changed, 8 insertions(+), 3 deletions(-)

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 538d34ca292..64cfc9b745a 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
@@ -1235,6 +1235,11 @@ public class InternalCatalog implements 
CatalogIf<Database> {
                         default:
                             throw new DdlException("Unsupported string type 
for ctas");
                     }
+                    if (resultExpr.getSrcSlotRef() != null
+                            && resultExpr.getSrcSlotRef().getTable() != null
+                            && 
!resultExpr.getSrcSlotRef().getTable().isManagedTable()) {
+                        typeDef = new TypeDef(ScalarType.createStringType());
+                    }
                 } else if (resultType.isDecimalV2() && 
resultType.equals(ScalarType.DECIMALV2)) {
                     typeDef = new TypeDef(ScalarType.createDecimalType(27, 9));
                 } else if (resultType.isDecimalV3()) {
diff --git 
a/regression-test/data/external_table_p0/jdbc/test_mysql_jdbc_catalog.out 
b/regression-test/data/external_table_p0/jdbc/test_mysql_jdbc_catalog.out
index b9604b55607..f81195948cf 100644
--- a/regression-test/data/external_table_p0/jdbc/test_mysql_jdbc_catalog.out
+++ b/regression-test/data/external_table_p0/jdbc/test_mysql_jdbc_catalog.out
@@ -346,7 +346,7 @@ binary      TEXT    Yes     false   \N      NONE
 bit    TEXT    Yes     false   \N      NONE
 blob   TEXT    Yes     false   \N      NONE
 boolean        TINYINT Yes     false   \N      NONE
-char   VARCHAR(65533)  Yes     false   \N      NONE
+char   TEXT    Yes     false   \N      NONE
 date   DATE    Yes     false   \N      NONE
 datetime       DATETIME        Yes     false   \N      NONE
 decimal        DECIMAL(12, 4)  Yes     false   \N      NONE
@@ -370,7 +370,7 @@ timestamp   DATETIME(4)     Yes     false   \N      NONE
 tinyint        TINYINT Yes     false   \N      NONE
 tinyint_u      SMALLINT        Yes     true    \N      
 varbinary      TEXT    Yes     false   \N      NONE
-varchar        VARCHAR(10)     Yes     false   \N      NONE
+varchar        TEXT    Yes     false   \N      NONE
 year   SMALLINT        Yes     false   \N      NONE
 
 -- !mysql_view --
diff --git 
a/regression-test/data/external_table_p0/jdbc/test_pg_jdbc_catalog.out 
b/regression-test/data/external_table_p0/jdbc/test_pg_jdbc_catalog.out
index d63ee2c0bad..adb337bedd1 100644
--- a/regression-test/data/external_table_p0/jdbc/test_pg_jdbc_catalog.out
+++ b/regression-test/data/external_table_p0/jdbc/test_pg_jdbc_catalog.out
@@ -2239,7 +2239,7 @@ bit_value BOOLEAN Yes     false   \N      NONE
 bitn_value     TEXT    Yes     false   \N      NONE
 bitnv_value    TEXT    Yes     false   \N      NONE
 box_value      TEXT    Yes     false   \N      NONE
-char_value     VARCHAR(65533)  Yes     true    \N      
+char_value     TEXT    Yes     false   \N      NONE
 cidr_value     TEXT    Yes     false   \N      NONE
 circle_value   TEXT    Yes     false   \N      NONE
 date_value     DATE    Yes     false   \N      NONE


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

Reply via email to