From 815342bf22cdfc563b88e7ae5a4f8984ba188cce Mon Sep 17 00:00:00 2001 From: ByteYue Date: Sun, 5 Mar 2023 17:20:43 +0800 Subject: [PATCH] enhance_mysql_data_type --- .../schema_scanner/schema_columns_scanner.cpp | 9 +++++++++ .../system/test_query_sys_data_type.out | 4 ++++ .../system/test_query_sys_data_type.out | 4 ++++ .../system/test_query_sys_data_type.groovy | 17 +++++++++++++++++ .../system/test_query_sys_data_type.groovy | 17 +++++++++++++++++ 5 files changed, 51 insertions(+) diff --git a/be/src/exec/schema_scanner/schema_columns_scanner.cpp b/be/src/exec/schema_scanner/schema_columns_scanner.cpp index 1f8682d5d6b65a..0d4d0ff39ca9f6 100644 --- a/be/src/exec/schema_scanner/schema_columns_scanner.cpp +++ b/be/src/exec/schema_scanner/schema_columns_scanner.cpp @@ -141,6 +141,15 @@ std::string SchemaColumnsScanner::_to_mysql_data_type_string(TColumnDesc& desc) case TPrimitiveType::JSONB: { return "json"; } + case TPrimitiveType::MAP: { + return "map"; + } + case TPrimitiveType::ARRAY: { + return "array"; + } + case TPrimitiveType::STRUCT: { + return "struct"; + } default: return "unknown"; } diff --git a/regression-test/data/nereids_p0/system/test_query_sys_data_type.out b/regression-test/data/nereids_p0/system/test_query_sys_data_type.out index c5273d2c5cc8bb..952814c3018866 100644 --- a/regression-test/data/nereids_p0/system/test_query_sys_data_type.out +++ b/regression-test/data/nereids_p0/system/test_query_sys_data_type.out @@ -8,3 +8,7 @@ os char set1 hll set2 bitmap +-- !sql -- +id int +c_array array + diff --git a/regression-test/data/query_p0/system/test_query_sys_data_type.out b/regression-test/data/query_p0/system/test_query_sys_data_type.out index c5273d2c5cc8bb..952814c3018866 100644 --- a/regression-test/data/query_p0/system/test_query_sys_data_type.out +++ b/regression-test/data/query_p0/system/test_query_sys_data_type.out @@ -8,3 +8,7 @@ os char set1 hll set2 bitmap +-- !sql -- +id int +c_array array + diff --git a/regression-test/suites/nereids_p0/system/test_query_sys_data_type.groovy b/regression-test/suites/nereids_p0/system/test_query_sys_data_type.groovy index 7164c1bde3fa59..491791bc5744d1 100644 --- a/regression-test/suites/nereids_p0/system/test_query_sys_data_type.groovy +++ b/regression-test/suites/nereids_p0/system/test_query_sys_data_type.groovy @@ -31,4 +31,21 @@ suite("test_query_sys_data_type", 'query,p0') { """ qt_sql "select column_name, data_type from information_schema.columns where table_schema = '${dbName}' and table_name = '${tbName}'" + + sql """ DROP TABLE IF EXISTS array_test """ + sql """ + CREATE TABLE `array_test` ( + `id` int(11) NULL COMMENT "", + `c_array` ARRAY NULL COMMENT "" + ) ENGINE=OLAP + DUPLICATE KEY(`id`) + COMMENT "OLAP" + DISTRIBUTED BY HASH(`id`) BUCKETS 1 + PROPERTIES ( + "replication_allocation" = "tag.location.default: 1", + "in_memory" = "false", + "storage_format" = "V2" + ) + """ + qt_sql "select column_name, data_type from information_schema.columns where table_schema = '${dbName}' and table_name = 'array_test'" } diff --git a/regression-test/suites/query_p0/system/test_query_sys_data_type.groovy b/regression-test/suites/query_p0/system/test_query_sys_data_type.groovy index 237cbaa1392881..97f99260831135 100644 --- a/regression-test/suites/query_p0/system/test_query_sys_data_type.groovy +++ b/regression-test/suites/query_p0/system/test_query_sys_data_type.groovy @@ -28,4 +28,21 @@ suite("test_query_sys_data_type", 'query,p0') { """ qt_sql "select column_name, data_type from information_schema.columns where table_schema = '${dbName}' and table_name = '${tbName}'" + + sql """ DROP TABLE IF EXISTS array_test """ + sql """ + CREATE TABLE `array_test` ( + `id` int(11) NULL COMMENT "", + `c_array` ARRAY NULL COMMENT "" + ) ENGINE=OLAP + DUPLICATE KEY(`id`) + COMMENT "OLAP" + DISTRIBUTED BY HASH(`id`) BUCKETS 1 + PROPERTIES ( + "replication_allocation" = "tag.location.default: 1", + "in_memory" = "false", + "storage_format" = "V2" + ) + """ + qt_sql "select column_name, data_type from information_schema.columns where table_schema = '${dbName}' and table_name = 'array_test'" }