This is an automated email from the ASF dual-hosted git repository. kxiao 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 62fb0e642e [chore](dynamic schema) deprecated create dynamic schema table (#21058) 62fb0e642e is described below commit 62fb0e642ef3b6fdaa5c23e9422d8826eb741162 Author: lihangyu <15605149...@163.com> AuthorDate: Wed Jun 21 14:44:57 2023 +0800 [chore](dynamic schema) deprecated create dynamic schema table (#21058) --- docs/en/docs/data-table/dynamic-schema-table.md | 146 --------------------- docs/sidebars.json | 1 - docs/zh-CN/docs/data-table/dynamic-schema-table.md | 145 -------------------- fe/fe-core/src/main/cup/sql_parser.cup | 4 +- .../apache/doris/common/util/PropertyAnalyzer.java | 2 +- .../suites/dynamic_table_p0/create_table.groovy | 14 +- .../suites/dynamic_table_p0/load.groovy | 20 ++- .../test_create_dynamic_table.groovy | 44 ++----- .../test_dytable_alter_type.groovy | 5 +- .../test_dytable_complex_data.groovy | 3 +- 10 files changed, 32 insertions(+), 352 deletions(-) diff --git a/docs/en/docs/data-table/dynamic-schema-table.md b/docs/en/docs/data-table/dynamic-schema-table.md deleted file mode 100644 index e158164f4b..0000000000 --- a/docs/en/docs/data-table/dynamic-schema-table.md +++ /dev/null @@ -1,146 +0,0 @@ ---- -{ - "title": "Dynamic schema table", - "language": "en" -} ---- - -<!-- -Licensed to the Apache Software Foundation (ASF) under one -or more contributor license agreements. See the NOTICE file -distributed with this work for additional information -regarding copyright ownership. The ASF licenses this file -to you under the Apache License, Version 2.0 (the -"License"); you may not use this file except in compliance -with the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, -software distributed under the License is distributed on an -"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -KIND, either express or implied. See the License for the -specific language governing permissions and limitations -under the License. ---> - -<version since="2.0.0"></version> - -A dynamic schema table is a special kind of table which schema expands automatically with the import procedure. Currently, this feature is mainly used for importing semi-structured data such as JSON. Because JSON is self-describing, we can extract the schema information from the original document and infer the final type information. This special table can reduce manual schema change operations and easily import semi-structured data and automatically expand its schema. - -## Terminology -- Schema change, changing the structure of the table, such as adding columns, reducing columns, changing column types -- Static column, column specified during table creation, such as partition columns, primary key columns -- Dynamic column, columns automatically recognized and added during import - -## Specifies the dynamic table identity -- Method 1: By adding ... to the last column. -- Method 2: By specifying "dynamic_schema" = "true" in properties - -## Create dynamic table - -```sql -CREATE DATABASE test_dynamic_table; - --- Create table and specify static column types, import will automatically convert to the type of static column --- Choose random bucketing --- Method 1: By ... Identifies the table as a dynamic table -CREATE TABLE IF NOT EXISTS test_dynamic_table ( - qid bigint, - `answers.date` array<datetime>, - `title` string, - ... -- ... Identifying a table as a dynamic table and its syntax for dynamic tables. - ) -DUPLICATE KEY(`qid`) -DISTRIBUTED BY RANDOM BUCKETS 5 -properties("replication_num" = "1"); - --- Method 2: By specifying "dynamic_schema" = "true" in properties -CREATE TABLE IF NOT EXISTS test_dynamic_table ( - qid bigint, - `answers.date` array<datetime>, - `title` string - ) -DUPLICATE KEY(`qid`) -DISTRIBUTED BY RANDOM BUCKETS 5 -properties( - "replication_num" = "1", - "dynamic_schema" = "true" -); - --- Three Columns are added to the table by default, and their types are specified -mysql> DESC test_dynamic_table; -+--------------+-----------------+------+-------+---------+-------+ -| Field | Type | Null | Key | Default | Extra | -+--------------+-----------------+------+-------+---------+-------+ -| qid | BIGINT | Yes | true | NULL | | -| answers.date | ARRAY<DATETIME> | Yes | false | NULL | NONE | -| user | TEXT | Yes | false | NULL | NONE | -+--------------+-----------------+------+-------+---------+-------+ -3 rows in set (0.00 sec) -``` - -## Importing data - -``` sql --- example1.json -'{ - "title": "Display Progress Bar at the Time of Processing", - "qid": "1000000", - "answers": [ - {"date": "2009-06-16T09:55:57.320", "user": "Micha\u0142 Niklas (22595)"}, - {"date": "2009-06-17T12:34:22.643", "user": "Jack Njiri (77153)"} - ], - "tag": ["vb6", "progress-bar"], - "user": "Jash", - "creationdate": "2009-06-16T07:28:42.770" -}' - -curl -X PUT -T example1.json --location-trusted -u root: -H "read_json_by_line:false" -H "format:json" http://127.0.0.1:8147/api/regression_test_dynamic_table/test_dynamic_table/_stream_load - --- Added five new columns: `title`, `answers.user`, `tag`, `title`, `creationdate` --- The types of the three columns: `qid`, `answers.date`, `user` remain the same as with the table was created --- The default value of the new array type is an empty array [] -mysql> DESC test_dynamic_table; -+--------------+-----------------+------+-------+---------+-------+ -| Field | Type | Null | Key | Default | Extra | -+--------------+-----------------+------+-------+---------+-------+ -| qid | BIGINT | Yes | true | NULL | | -| answers.date | ARRAY<DATETIME> | Yes | false | NULL | NONE | -| title | TEXT | Yes | false | NULL | NONE | -| answers.user | ARRAY<TEXT> | No | false | [] | NONE | -| tag | ARRAY<TEXT> | No | false | [] | NONE | -| user | TEXT | Yes | false | NULL | NONE | -| creationdate | TEXT | Yes | false | NULL | NONE | -| date | TEXT | Yes | false | NULL | NONE | -+--------------+-----------------+------+-------+---------+-------+ - --- Batch import data --- Specifying -H "read_json_by_line:true", parsing JSON line by line -curl -X PUT -T example_batch.json --location-trusted -u root: -H "read_json_by_line:true" -H "format:json" http://127.0.0.1:8147/api/regression_test_dynamic_table/test_dynamic_table/_stream_load - --- Specifying -H "strip_outer_array:true", parsing the entire file as a JSON array, each element in the array is the same, more efficient parsing way -curl -X PUT -T example_batch_array.json --location-trusted -u root: -H "strip_outer_array:true" -H "format:json" http://127.0.0.1:8147/api/regression_test_dynamic_table/test_dynamic_table/_stream_load -``` -For a dynamic table, you can also use S3load or Routine load, with similar usage. - - -## Adding Index to Dynamic Columns -```sql --- Create an inverted index on the title column, using English parsing. -CREATE INDEX title_idx ON test_dynamic_table (`title`) using inverted PROPERTIES("parser"="english") -``` - -## Type conflict resolution - -In the first batch import, the unified type will be automatically inferred and used as the final Column type, so it is recommended to keep the Column type consistent, for example: -``` -{"id" : 123} -{"id" : "123"} --- The type will finally be inferred as Text type, and if {"id" : 123} is imported later, the type will automatically be converted to String type - -For types that cannot be unified, such as: -{"id" : [123]} -{"id" : 123} --- Importing will result in an error." -``` diff --git a/docs/sidebars.json b/docs/sidebars.json index d613fcaff5..40011ef5df 100644 --- a/docs/sidebars.json +++ b/docs/sidebars.json @@ -50,7 +50,6 @@ "data-table/basic-usage", "data-table/hit-the-rollup", "data-table/best-practice", - "data-table/dynamic-schema-table", { "type": "category", "label": "Index", diff --git a/docs/zh-CN/docs/data-table/dynamic-schema-table.md b/docs/zh-CN/docs/data-table/dynamic-schema-table.md deleted file mode 100644 index ffb1893193..0000000000 --- a/docs/zh-CN/docs/data-table/dynamic-schema-table.md +++ /dev/null @@ -1,145 +0,0 @@ ---- -{ - "title": "动态 Schema 表", - "language": "zh-CN" -} ---- - -<!-- -Licensed to the Apache Software Foundation (ASF) under one -or more contributor license agreements. See the NOTICE file -distributed with this work for additional information -regarding copyright ownership. The ASF licenses this file -to you under the Apache License, Version 2.0 (the -"License"); you may not use this file except in compliance -with the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, -software distributed under the License is distributed on an -"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -KIND, either express or implied. See the License for the -specific language governing permissions and limitations -under the License. ---> - -<version since="2.0.0"></version> - -动态 Schema 表是一种特殊的表,其 Schema 随着导入自动进行扩展。目前该功能,主要用于半结构数据,例如 JSON 等的导入、自动列生成。因为 JSON 是类型自描述的,所以我们可以从原始文档中提取 Schema 信息,推断最终类型信息。这种特殊的表可以减少人工 Schema Change 的操作,并轻松导入半结构数据并自动扩展其 Schema。 - -## 名词解释 -- Schema Change, 改变表的结构, 例如增加列、减少列, 修改列类型 -- 静态列, 在建表时指定的列, 例如分区列、主键列 -- 动态列, 随着导入自动识别并增加的列 - -## 指定动态表标识 -- 方式一:通过在最后一列后加 ... -- 方式二:通过在properties中指定 "dynamic_schema" = "true" - -## 建表 - -```sql -CREATE DATABASE test_dynamic_table; - --- 建表, 并指定静态列类型, 导入遇到对应列会自动转换成静态列的类型 --- 选择随机分桶方式 --- 方式一:通过...标识该表是动态表 -CREATE TABLE IF NOT EXISTS test_dynamic_table ( - qid bigint, - `answers.date` array<datetime>, - `title` string, - ... -- ...标识该表是动态表, 是动态表的语法 - ) -DUPLICATE KEY(`qid`) -DISTRIBUTED BY RANDOM BUCKETS 5 -properties("replication_num" = "1"); - --- 方式二:通过在properties中指定 "dynamic_schema" = "true" -CREATE TABLE IF NOT EXISTS test_dynamic_table ( - qid bigint, - `answers.date` array<datetime>, - `title` string - ) -DUPLICATE KEY(`qid`) -DISTRIBUTED BY RANDOM BUCKETS 5 -properties( - "replication_num" = "1", - "dynamic_schema" = "true" -); - --- 可以看到三列Column在表中默认添加, 类型是指定类型 -mysql> DESC test_dynamic_table; -+--------------+-----------------+------+-------+---------+-------+ -| Field | Type | Null | Key | Default | Extra | -+--------------+-----------------+------+-------+---------+-------+ -| qid | BIGINT | Yes | true | NULL | | -| answers.date | ARRAY<DATETIME> | Yes | false | NULL | NONE | -| user | TEXT | Yes | false | NULL | NONE | -+--------------+-----------------+------+-------+---------+-------+ -3 rows in set (0.00 sec) -``` - -## 导入数据 - -``` sql --- example1.json -'{ - "title": "Display Progress Bar at the Time of Processing", - "qid": "1000000", - "answers": [ - {"date": "2009-06-16T09:55:57.320", "user": "Micha\u0142 Niklas (22595)"}, - {"date": "2009-06-17T12:34:22.643", "user": "Jack Njiri (77153)"} - ], - "tag": ["vb6", "progress-bar"], - "user": "Jash", - "creationdate": "2009-06-16T07:28:42.770" -}' - -curl -X PUT -T example1.json --location-trusted -u root: -H "read_json_by_line:false" -H "format:json" http://127.0.0.1:8147/api/regression_test_dynamic_table/test_dynamic_table/_stream_load - --- 新增 title,answers.user, tag, title, creationdate 五列 --- 且 qid,answers.date,user三列类型与建表时保持一致 --- 新增数组类型默认Default值为空数组[] -mysql> DESC test_dynamic_table; -+--------------+-----------------+------+-------+---------+-------+ -| Field | Type | Null | Key | Default | Extra | -+--------------+-----------------+------+-------+---------+-------+ -| qid | BIGINT | Yes | true | NULL | | -| answers.date | ARRAY<DATETIME> | Yes | false | NULL | NONE | -| title | TEXT | Yes | false | NULL | NONE | -| answers.user | ARRAY<TEXT> | No | false | [] | NONE | -| tag | ARRAY<TEXT> | No | false | [] | NONE | -| user | TEXT | Yes | false | NULL | NONE | -| creationdate | TEXT | Yes | false | NULL | NONE | -| date | TEXT | Yes | false | NULL | NONE | -+--------------+-----------------+------+-------+---------+-------+ - --- 批量导入数据 - --- 指定 -H "read_json_by_line:true", 逐行解析JSON -curl -X PUT -T example_batch.json --location-trusted -u root: -H "read_json_by_line:true" -H "format:json" http://127.0.0.1:8147/api/regression_test_dynamic_table/test_dynamic_table/_stream_load - --- 指定 -H "strip_outer_array:true", 整个文件当做一个JSON array解析, array中的每个元素是一行, 解析效率更高效 -curl -X PUT -T example_batch_array.json --location-trusted -u root: -H "strip_outer_array:true" -H "format:json" http://127.0.0.1:8147/api/regression_test_dynamic_table/test_dynamic_table/_stream_load -``` -对于 Dynamic Table, 你也可以使用 S3 Load 或者 Routine Load, 使用方式类似 - -## 对动态列增加索引 -```sql --- 将在 titile 列上新建倒排索引, 并按照english分词 -CREATE INDEX title_idx ON test_dynamic_table (`title`) using inverted PROPERTIES("parser"="english") -``` - -## 类型冲突 -在第一批导入会自动推断出统一的类型, 并以此作为最终的 Column 类型,所以建议保持 Column 类型的一致, 例如 -``` -{"id" : 123} -{"id" : "123"} --- 类型会被最终推断为Text类型, 如果在后续导入{"id" : 123}则类型会被自动转成String类型 - -对于无法统一的类型, 例如 -{"id" : [123]} -{"id" : 123} --- 导入将会报错 -``` diff --git a/fe/fe-core/src/main/cup/sql_parser.cup b/fe/fe-core/src/main/cup/sql_parser.cup index e0ca4e9857..500a83bb3c 100644 --- a/fe/fe-core/src/main/cup/sql_parser.cup +++ b/fe/fe-core/src/main/cup/sql_parser.cup @@ -1833,7 +1833,7 @@ create_stmt ::= distribution, tblProperties, extProperties, tableComment, index); :} | KW_CREATE opt_external:isExternal KW_TABLE opt_if_not_exists:ifNotExists table_name:name - LPAREN column_definition_list:columns COMMA DOTDOTDOT RPAREN opt_engine:engineName + LPAREN column_definition_list:columns COMMA RPAREN opt_engine:engineName opt_keys:keys opt_comment:tableComment opt_partition:partition @@ -1859,7 +1859,7 @@ create_stmt ::= distribution, tblProperties, extProperties, tableComment, index, false); :} | KW_CREATE opt_external:isExternal KW_TABLE opt_if_not_exists:ifNotExists table_name:name - LPAREN column_definition_list:columns COMMA index_definition_list:indexes COMMA DOTDOTDOT RPAREN opt_engine:engineName + LPAREN column_definition_list:columns COMMA index_definition_list:indexes COMMA RPAREN opt_engine:engineName opt_keys:keys opt_comment:tableComment opt_partition:partition diff --git a/fe/fe-core/src/main/java/org/apache/doris/common/util/PropertyAnalyzer.java b/fe/fe-core/src/main/java/org/apache/doris/common/util/PropertyAnalyzer.java index e4be16a274..d18d866b43 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/common/util/PropertyAnalyzer.java +++ b/fe/fe-core/src/main/java/org/apache/doris/common/util/PropertyAnalyzer.java @@ -96,7 +96,7 @@ public class PropertyAnalyzer { // _auto_bucket can only set in create table stmt rewrite bucket and can not be changed public static final String PROPERTIES_AUTO_BUCKET = "_auto_bucket"; public static final String PROPERTIES_ESTIMATE_PARTITION_SIZE = "estimate_partition_size"; - public static final String PROPERTIES_DYNAMIC_SCHEMA = "dynamic_schema"; + public static final String PROPERTIES_DYNAMIC_SCHEMA = "deprecated_dynamic_schema"; public static final String PROPERTIES_TABLET_TYPE = "tablet_type"; diff --git a/regression-test/suites/dynamic_table_p0/create_table.groovy b/regression-test/suites/dynamic_table_p0/create_table.groovy index ca1d079af2..ff71435746 100644 --- a/regression-test/suites/dynamic_table_p0/create_table.groovy +++ b/regression-test/suites/dynamic_table_p0/create_table.groovy @@ -32,18 +32,18 @@ suite("test_create_dynamic_table", "dynamic_table") { } } sql "DROP TABLE IF EXISTS dynamic_table_create_test" - expect_result("""CREATE TABLE dynamic_table_create_test (x int, y int, ...) ENGINE = Olap DUPLICATE KEY(x) DISTRIBUTED BY HASH(y) BUCKETS 1 PROPERTIES("replication_num" = "1");;""", "success") + expect_result("""CREATE TABLE dynamic_table_create_test (x int, y int) ENGINE = Olap DUPLICATE KEY(x) DISTRIBUTED BY HASH(y) BUCKETS 1 PROPERTIES("replication_num" = "1", "deprecated_dynamic_schema" = "true");;""", "success") sql "DROP TABLE IF EXISTS dynamic_table_create_test" - expect_result("""CREATE TABLE dynamic_table_create_test (x int, y int, ...) ENGINE = Olap DUPLICATE KEY(x) DISTRIBUTED BY RANDOM BUCKETS 1 PROPERTIES("replication_num" = "1");;""", "success") + expect_result("""CREATE TABLE dynamic_table_create_test (x int, y int) ENGINE = Olap DUPLICATE KEY(x) DISTRIBUTED BY RANDOM BUCKETS 1 PROPERTIES("replication_num" = "1", "deprecated_dynamic_schema" = "true");;""", "success") sql "DROP TABLE IF EXISTS dynamic_table_create_test" - expect_result("""CREATE TABLE dynamic_table_create_test (x int, y int, ...) ENGINE = Olap DUPLICATE KEY(x) PARTITION BY RANGE(y) (partition `p1` values less than ("1000")) DISTRIBUTED BY RANDOM BUCKETS 1 PROPERTIES("replication_num" = "1");;""", "success") + expect_result("""CREATE TABLE dynamic_table_create_test (x int, y int) ENGINE = Olap DUPLICATE KEY(x) PARTITION BY RANGE(y) (partition `p1` values less than ("1000")) DISTRIBUTED BY RANDOM BUCKETS 1 PROPERTIES("replication_num" = "1", "deprecated_dynamic_schema" = "true");;""", "success") sql "DROP TABLE IF EXISTS dynamic_table_create_test" - expect_result("""CREATE TABLE dynamic_table_create_test (x int, y int, ...) ENGINE = Olap DUPLICATE KEY(x) PARTITION BY RANGE(x) (partition `p1` values less than ("1000")) DISTRIBUTED BY RANDOM BUCKETS 1 PROPERTIES("replication_num" = "1");;""", "success") + expect_result("""CREATE TABLE dynamic_table_create_test (x int, y int) ENGINE = Olap DUPLICATE KEY(x) PARTITION BY RANGE(x) (partition `p1` values less than ("1000")) DISTRIBUTED BY RANDOM BUCKETS 1 PROPERTIES("replication_num" = "1", "deprecated_dynamic_schema" = "true");;""", "success") sql "DROP TABLE IF EXISTS dynamic_table_create_test" - expect_result("""CREATE TABLE dynamic_table_create_test (x int, y int, ...) ENGINE = Olap DUPLICATE KEY(x, y) PARTITION BY RANGE(x, y) (partition `p1` values less than ("1000", "1000")) DISTRIBUTED BY RANDOM BUCKETS 1 PROPERTIES("replication_num" = "1");;""", "success") + expect_result("""CREATE TABLE dynamic_table_create_test (x int, y int) ENGINE = Olap DUPLICATE KEY(x, y) PARTITION BY RANGE(x, y) (partition `p1` values less than ("1000", "1000")) DISTRIBUTED BY RANDOM BUCKETS 1 PROPERTIES("replication_num" = "1", "deprecated_dynamic_schema" = "true");;""", "success") sql "DROP TABLE IF EXISTS dynamic_table_create_test" - expect_result("""CREATE TABLE dynamic_table_create_test (x int, y int, z array<int>, ...) ENGINE = Olap DUPLICATE KEY(x, y) DISTRIBUTED BY HASH(x, y) BUCKETS 2 PROPERTIES("replication_num" = "1");;""", "success"); + expect_result("""CREATE TABLE dynamic_table_create_test (x int, y int, z array<int>) ENGINE = Olap DUPLICATE KEY(x, y) DISTRIBUTED BY HASH(x, y) BUCKETS 2 PROPERTIES("replication_num" = "1", "deprecated_dynamic_schema" = "true");;""", "success"); sql "DROP TABLE IF EXISTS dynamic_table_create_test" - expect_result("""CREATE TABLE dynamic_table_create_test (x int, y int, z array<date>, ...) ENGINE = Olap DUPLICATE KEY(x, y) PARTITION BY RANGE(x, y) (partition `p1` values less than ("1000", "1000")) DISTRIBUTED BY HASH(x, y) BUCKETS 2 PROPERTIES("replication_num" = "1");;""", "success") + expect_result("""CREATE TABLE dynamic_table_create_test (x int, y int, z array<date>) ENGINE = Olap DUPLICATE KEY(x, y) PARTITION BY RANGE(x, y) (partition `p1` values less than ("1000", "1000")) DISTRIBUTED BY HASH(x, y) BUCKETS 2 PROPERTIES("replication_num" = "1", "deprecated_dynamic_schema" = "true");;""", "success") sql "DROP TABLE IF EXISTS dynamic_table_create_test" } diff --git a/regression-test/suites/dynamic_table_p0/load.groovy b/regression-test/suites/dynamic_table_p0/load.groovy index 6ac6836194..766642060b 100644 --- a/regression-test/suites/dynamic_table_p0/load.groovy +++ b/regression-test/suites/dynamic_table_p0/load.groovy @@ -63,12 +63,11 @@ suite("regression_test_dynamic_table", "dynamic_table"){ sql "DROP TABLE IF EXISTS ${table_name}" sql """ CREATE TABLE IF NOT EXISTS ${table_name} ( - id bigint, - ... + id bigint ) DUPLICATE KEY(`id`) DISTRIBUTED BY RANDOM BUCKETS 5 - properties("replication_num" = "1"); + properties("replication_num" = "1", "deprecated_dynamic_schema" = "true"); """ //stream load src_json @@ -81,12 +80,11 @@ suite("regression_test_dynamic_table", "dynamic_table"){ sql "DROP TABLE IF EXISTS ${table_name}" sql """ CREATE TABLE IF NOT EXISTS ${table_name}( - id bigint, - ... + id bigint ) UNIQUE KEY(`id`) DISTRIBUTED BY HASH(`id`) BUCKETS 5 - properties("replication_num" = "1", "enable_unique_key_merge_on_write" = "true"); + properties("replication_num" = "1", "enable_unique_key_merge_on_write" = "true", "deprecated_dynamic_schema" = "true"); """ //stream load src_json @@ -105,11 +103,10 @@ suite("regression_test_dynamic_table", "dynamic_table"){ `title` string, INDEX creation_date_idx(`creationdate`) USING INVERTED COMMENT 'creationdate index', INDEX title_idx(`title`) USING INVERTED PROPERTIES("parser"="standard") COMMENT 'title index', - ... ) DUPLICATE KEY(`qid`) DISTRIBUTED BY RANDOM BUCKETS 5 - properties("replication_num" = "1"); + properties("replication_num" = "1", "deprecated_dynamic_schema" = "true"); """ //stream load src_json @@ -135,11 +132,10 @@ suite("regression_test_dynamic_table", "dynamic_table"){ CREATE TABLE IF NOT EXISTS ${table_name} ( qid bigint, XXXX bigint, - ... ) DUPLICATE KEY(`qid`) DISTRIBUTED BY HASH(`qid`) BUCKETS 5 - properties("replication_num" = "1"); + properties("replication_num" = "1", "deprecated_dynamic_schema" = "true"); """ load_json_data.call(table_name, 'true', 'json', 'true', "invalid_dimension.json", 'false') load_json_data.call(table_name, 'true', 'json', 'true', "invalid_format.json", 'false') @@ -157,13 +153,13 @@ suite("regression_test_dynamic_table", "dynamic_table"){ id varchar(30) default 'defualt-id' COMMENT '', type varchar(50) NULL COMMENT '', public boolean NULL COMMENT '', - ... ) ENGINE=OLAP DUPLICATE KEY(created_at) DISTRIBUTED BY HASH(id) BUCKETS 32 PROPERTIES ( - 'replication_allocation' = 'tag.location.default: 1' + 'replication_allocation' = 'tag.location.default: 1', + "deprecated_dynamic_schema" = "true" ); """ def paths = [ diff --git a/regression-test/suites/dynamic_table_p0/test_create_dynamic_table.groovy b/regression-test/suites/dynamic_table_p0/test_create_dynamic_table.groovy index b92814da0d..cccdcf14ee 100644 --- a/regression-test/suites/dynamic_table_p0/test_create_dynamic_table.groovy +++ b/regression-test/suites/dynamic_table_p0/test_create_dynamic_table.groovy @@ -17,32 +17,15 @@ suite("test_dynamic_table", "dynamic_table"){ - def create_none_dynamic_table_result = "fail" - try { - sql """ - CREATE TABLE IF NOT EXISTS t_dynamic1 - ( - ... - ) - DISTRIBUTED BY HASH(`name`) BUCKETS 10 - PROPERTIES("replication_num" = "1") - """ - create_none_dynamic_table_result = "success" - } catch(Exception ex) { - logger.info("create none dynamic table result: " + ex) - } - assertEquals(create_none_dynamic_table_result, "fail") - def create_dynamic_table_assign_not_exist_key_result = "fail" try { sql """ CREATE TABLE IF NOT EXISTS t_dynamic1 ( name varchar(50), - ... ) DISTRIBUTED BY HASH(`id`) BUCKETS 10 - PROPERTIES("replication_num" = "1") + PROPERTIES("replication_num" = "1", "deprecated_dynamic_schema" = "true") """ create_dynamic_table_assign_not_exist_key_result = "success" } catch(Exception ex) { @@ -55,12 +38,11 @@ suite("test_dynamic_table", "dynamic_table"){ sql """ CREATE TABLE IF NOT EXISTS ${TbName1} ( - name varchar(50), - ... + name varchar(50) ) DUPLICATE KEY(`name`) DISTRIBUTED BY HASH(`name`) BUCKETS 10 - PROPERTIES("replication_num" = "1") + PROPERTIES("replication_num" = "1", "deprecated_dynamic_schema" = "true") """ def TbName2 = "test_ceate_dymanic_table_2" @@ -73,12 +55,11 @@ suite("test_dynamic_table", "dynamic_table"){ date datetime, index id_idx(`id`) USING INVERTED COMMENT 'id index', index name_idx(`name`) USING INVERTED PROPERTIES("parser"="english") COMMENT 'name index', - index date_idx(`date`) COMMENT 'date index', - ... + index date_idx(`date`) COMMENT 'date index' ) DUPLICATE KEY(`id`) DISTRIBUTED BY HASH(`id`) BUCKETS 10 - PROPERTIES("replication_num" = "1") + PROPERTIES("replication_num" = "1", "deprecated_dynamic_schema" = "true") """ def TbName3 = "test_ceate_dymanic_table_3" @@ -86,12 +67,11 @@ suite("test_dynamic_table", "dynamic_table"){ sql """ CREATE TABLE IF NOT EXISTS ${TbName3} ( - `repo.id` int, - ... + `repo.id` int ) DUPLICATE KEY(`repo.id`) DISTRIBUTED BY HASH(`repo.id`) BUCKETS 10 - PROPERTIES("replication_num" = "1"); + PROPERTIES("replication_num" = "1", "deprecated_dynamic_schema" = "true"); """ @@ -101,12 +81,11 @@ suite("test_dynamic_table", "dynamic_table"){ sql """ CREATE TABLE IF NOT EXISTS ${TbName4} ( - repo.id int, - ... + repo.id int ) DUPLICATE KEY(`repo.id`) DISTRIBUTED BY HASH(`repo.id`) BUCKETS 10 - PROPERTIES("replication_num" = "1"); + PROPERTIES("replication_num" = "1", "deprecated_dynamic_schema" = "true"); """ create_children_colume_without_single_quota_result = "success" }catch(Exception ex) { @@ -123,12 +102,11 @@ suite("test_dynamic_table", "dynamic_table"){ date datetime, `name.list` array<int>, tag ARRAY<NOT_NULL(ARRAY<text>)>, - data ARRAY<ARRAY<NOT_NULL(ARRAY<date>)>>, - ... + data ARRAY<ARRAY<NOT_NULL(ARRAY<date>)>> ) DUPLICATE KEY(`date`) DISTRIBUTED BY HASH(`date`) BUCKETS 10 - PROPERTIES("replication_num" = "3"); + PROPERTIES("replication_num" = "3", "deprecated_dynamic_schema" = "true"); """ }catch(Exception ex) { logger.info("create array table, result: " + ex) diff --git a/regression-test/suites/dynamic_table_p0/test_dytable_alter_type.groovy b/regression-test/suites/dynamic_table_p0/test_dytable_alter_type.groovy index 5b52f7579d..09992c3c12 100644 --- a/regression-test/suites/dynamic_table_p0/test_dytable_alter_type.groovy +++ b/regression-test/suites/dynamic_table_p0/test_dytable_alter_type.groovy @@ -130,12 +130,11 @@ suite("test_dynamic_table", "dynamic_table"){ sql """ CREATE TABLE IF NOT EXISTS ${table_name} ( name char(50), - `${colume_name}` ${src_type}, - ... + `${colume_name}` ${src_type} ) DUPLICATE KEY(`name`) DISTRIBUTED BY HASH(`name`) BUCKETS 10 - properties("replication_num" = "1"); + properties("replication_num" = "1", "deprecated_dynamic_schema" = "true"); """ //stream load src_json diff --git a/regression-test/suites/dynamic_table_p0/test_dytable_complex_data.groovy b/regression-test/suites/dynamic_table_p0/test_dytable_complex_data.groovy index 245b228f5e..36fa410b8f 100644 --- a/regression-test/suites/dynamic_table_p0/test_dytable_complex_data.groovy +++ b/regression-test/suites/dynamic_table_p0/test_dytable_complex_data.groovy @@ -75,11 +75,10 @@ suite("test_dynamic_table", "dynamic_table"){ sql """ CREATE TABLE IF NOT EXISTS ${table_name} ( ${colume_set} - ... ) ${data_model} KEY(${key}) DISTRIBUTED BY HASH(`${columes[0]}`) BUCKETS 10 - properties("replication_num" = "${replica_num}"); + properties("replication_num" = "${replica_num}", "deprecated_dynamic_schema" = "true"); """ }catch(Exception ex) { logger.info("create ${table_name} fail, catch exception: ${ex}".toString()) --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org