diff --git a/docker/thirdparties/docker-compose/iceberg/scripts/create_preinstalled_scripts/paimon/run03.sql b/docker/thirdparties/docker-compose/iceberg/scripts/create_preinstalled_scripts/paimon/run03.sql index bd8d673636c270..bee50ea7e0be84 100644 --- a/docker/thirdparties/docker-compose/iceberg/scripts/create_preinstalled_scripts/paimon/run03.sql +++ b/docker/thirdparties/docker-compose/iceberg/scripts/create_preinstalled_scripts/paimon/run03.sql @@ -8,8 +8,11 @@ drop table if exists test_varchar_char_type; create table test_varchar_char_type ( c1 int, c2 char(1), - c3 char(2147483647), - c4 varchar(1), - c6 varchar(2147483646), - c5 varchar(2147483647) + c3 char(254), + c4 char(2147483647), + c5 varchar(1), + c6 varchar(65533), + c7 varchar(2147483646), + c8 varchar(2147483647), + c9 string ); diff --git a/fe/fe-core/src/main/java/org/apache/doris/datasource/paimon/PaimonUtil.java b/fe/fe-core/src/main/java/org/apache/doris/datasource/paimon/PaimonUtil.java index eca3a66f552092..9d108c2ad9a45a 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/datasource/paimon/PaimonUtil.java +++ b/fe/fe-core/src/main/java/org/apache/doris/datasource/paimon/PaimonUtil.java @@ -232,9 +232,17 @@ private static Type paimonPrimitiveTypeToDorisType(org.apache.paimon.types.DataT case TINYINT: return Type.TINYINT; case VARCHAR: - return ScalarType.createVarcharType(((VarCharType) dataType).getLength()); + int varcharLen = ((VarCharType) dataType).getLength(); + if (varcharLen > 65533) { + return ScalarType.createStringType(); + } + return ScalarType.createVarcharType(varcharLen); case CHAR: - return ScalarType.createCharType(((CharType) dataType).getLength()); + int charLen = ((CharType) dataType).getLength(); + if (charLen > 255) { + return ScalarType.createStringType(); + } + return ScalarType.createCharType(charLen); case BINARY: case VARBINARY: return Type.STRING; diff --git a/regression-test/data/external_table_p0/paimon/paimon_system_table.out b/regression-test/data/external_table_p0/paimon/paimon_system_table.out index 3bfc38f8bd133f..c9877a46812aa6 100644 --- a/regression-test/data/external_table_p0/paimon/paimon_system_table.out +++ b/regression-test/data/external_table_p0/paimon/paimon_system_table.out @@ -41,13 +41,13 @@ -- !desc_direct_query_ctl_db_table -- snapshot_id bigint No true \N NONE schema_id bigint No false \N NONE -commit_user varchar(2147483647) No false \N NONE +commit_user text No false \N NONE commit_identifier bigint No false \N NONE -commit_kind varchar(2147483647) No false \N NONE +commit_kind text No false \N NONE commit_time datetime(3) No false \N NONE -base_manifest_list varchar(2147483647) No false \N NONE -delta_manifest_list varchar(2147483647) No false \N NONE -changelog_manifest_list varchar(2147483647) Yes false \N NONE +base_manifest_list text No false \N NONE +delta_manifest_list text No false \N NONE +changelog_manifest_list text Yes false \N NONE total_record_count bigint Yes false \N NONE delta_record_count bigint Yes false \N NONE changelog_record_count bigint Yes false \N NONE @@ -56,13 +56,13 @@ watermark bigint Yes false \N NONE -- !desc_direct_query_db_table -- snapshot_id bigint No true \N NONE schema_id bigint No false \N NONE -commit_user varchar(2147483647) No false \N NONE +commit_user text No false \N NONE commit_identifier bigint No false \N NONE -commit_kind varchar(2147483647) No false \N NONE +commit_kind text No false \N NONE commit_time datetime(3) No false \N NONE -base_manifest_list varchar(2147483647) No false \N NONE -delta_manifest_list varchar(2147483647) No false \N NONE -changelog_manifest_list varchar(2147483647) Yes false \N NONE +base_manifest_list text No false \N NONE +delta_manifest_list text No false \N NONE +changelog_manifest_list text Yes false \N NONE total_record_count bigint Yes false \N NONE delta_record_count bigint Yes false \N NONE changelog_record_count bigint Yes false \N NONE @@ -71,13 +71,13 @@ watermark bigint Yes false \N NONE -- !desc_direct_query_table -- snapshot_id bigint No true \N NONE schema_id bigint No false \N NONE -commit_user varchar(2147483647) No false \N NONE +commit_user text No false \N NONE commit_identifier bigint No false \N NONE -commit_kind varchar(2147483647) No false \N NONE +commit_kind text No false \N NONE commit_time datetime(3) No false \N NONE -base_manifest_list varchar(2147483647) No false \N NONE -delta_manifest_list varchar(2147483647) No false \N NONE -changelog_manifest_list varchar(2147483647) Yes false \N NONE +base_manifest_list text No false \N NONE +delta_manifest_list text No false \N NONE +changelog_manifest_list text Yes false \N NONE total_record_count bigint Yes false \N NONE delta_record_count bigint Yes false \N NONE changelog_record_count bigint Yes false \N NONE diff --git a/regression-test/data/external_table_p0/paimon/test_paimon_char_varchar_type.out b/regression-test/data/external_table_p0/paimon/test_paimon_char_varchar_type.out index 80fca7ed4024b9..e7dcf54571a42e 100644 --- a/regression-test/data/external_table_p0/paimon/test_paimon_char_varchar_type.out +++ b/regression-test/data/external_table_p0/paimon/test_paimon_char_varchar_type.out @@ -2,8 +2,11 @@ -- !q0 -- c1 int Yes true \N c2 char(1) Yes true \N -c3 char(2147483647) Yes true \N -c4 varchar(1) Yes true \N -c6 varchar(2147483646) Yes true \N -c5 varchar(2147483647) Yes true \N +c3 char(254) Yes true \N +c4 text Yes true \N +c5 varchar(1) Yes true \N +c6 varchar(65533) Yes true \N +c7 text Yes true \N +c8 text Yes true \N +c9 text Yes true \N diff --git a/regression-test/data/external_table_p0/paimon/test_paimon_schema_change.out b/regression-test/data/external_table_p0/paimon/test_paimon_schema_change.out index 90b56b63a3dcca..1bf68f8cbf54f5 100644 --- a/regression-test/data/external_table_p0/paimon/test_paimon_schema_change.out +++ b/regression-test/data/external_table_p0/paimon/test_paimon_schema_change.out @@ -1,8 +1,8 @@ -- This file is automatically generated. You should know what you did if you want to edit this -- !desc_1 -- -full_name varchar(2147483647) Yes true \N +full_name text Yes true \N id bigint Yes true \N -location varchar(2147483647) Yes true \N +location text Yes true \N salary decimal(12,2) Yes true \N -- !parquet_pk_1 -- @@ -74,9 +74,9 @@ Ken 11 Austin 9000.00 Laura 12 Portland 10000.00 -- !desc_2 -- -full_name varchar(2147483647) Yes true \N +full_name text Yes true \N id bigint Yes true \N -location varchar(2147483647) Yes true \N +location text Yes true \N salary decimal(12,2) Yes true \N -- !orc_pk_1 -- @@ -184,9 +184,9 @@ Laura 20 Portland 10000.00 -- !desc_3 -- k int Yes true \N -vv varchar(2147483647) Yes true \N -new_col3 map Yes true \N -new_col2 struct Yes true \N +vv text Yes true \N +new_col3 map Yes true \N +new_col2 struct Yes true \N new_col1 array Yes true \N -- !parquet_1 -- @@ -202,9 +202,9 @@ new_col1 array Yes true \N -- !desc_4 -- k int Yes true \N -vv varchar(2147483647) Yes true \N -new_col3 map Yes true \N -new_col2 struct Yes true \N +vv text Yes true \N +new_col3 map Yes true \N +new_col2 struct Yes true \N new_col1 array Yes true \N -- !orc_1 --