Skip to content

Commit b88a6a8

Browse files
committed
[test](regression) Ignore unrelated properties in nested comment checks
### What problem does this PR solve? Related PR: #68307 Problem Summary: Comparing the full SHOW CREATE TABLE statement makes the nested-comment regression depend on Cloud replication/cache properties, binlog settings and the default index format. Record the table name and column definitions for SHOW CREATE, replayed DDL and CREATE TABLE LIKE, while still replaying the complete generated statement. ### Release note None ### Check List (For Author) - Test: Regression test — generated output through run-regression-test.sh; verified with default settings and with binlog enabled/index format V2. - Behavior changed: No production change - Does this need documentation: No
1 parent 4a7cf3b commit b88a6a8

2 files changed

Lines changed: 16 additions & 5 deletions

File tree

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
11
-- This file is automatically generated. You should know what you did if you want to edit this
22
-- !show_create --
3-
struct_nested_comment CREATE TABLE `struct_nested_comment` (\n `id` int NULL,\n `s` struct<a:int,b:text comment "owner''s \\\\path",c:int> NULL COMMENT "top-level",\n `n` struct<lvl1:struct<lvl2:int comment "deep doc">> NULL,\n `arr` array<struct<inside:int comment "in array">> NULL\n) ENGINE=OLAP\nDUPLICATE KEY(`id`)\nDISTRIBUTED BY HASH(`id`) BUCKETS 1\nPROPERTIES (\n"replication_allocation" = "tag.location.default: 1",\n"min_load_replica_num" = "-1",\n"is_being_synced" = "false",\n"storage_medium" = "hdd",\n"storage_format" = "V2",\n"inverted_index_storage_format" = "V3",\n"light_schema_change" = "true",\n"disable_auto_compaction" = "false",\n"group_commit_interval_ms" = "10000",\n"group_commit_data_bytes" = "134217728"\n);
3+
struct_nested_comment `id` int NULL,\n `s` struct<a:int,b:text comment "owner''s \\\\path",c:int> NULL COMMENT "top-level",\n `n` struct<lvl1:struct<lvl2:int comment "deep doc">> NULL,\n `arr` array<struct<inside:int comment "in array">> NULL
4+
5+
-- !show_create_replay --
6+
struct_nested_comment_replay `id` int NULL,\n `s` struct<a:int,b:text comment "owner''s \\\\path",c:int> NULL COMMENT "top-level",\n `n` struct<lvl1:struct<lvl2:int comment "deep doc">> NULL,\n `arr` array<struct<inside:int comment "in array">> NULL
7+
8+
-- !show_create_like --
9+
struct_nested_comment_like `id` int NULL,\n `s` struct<a:int,b:text comment "owner''s \\\\path",c:int> NULL COMMENT "top-level",\n `n` struct<lvl1:struct<lvl2:int comment "deep doc">> NULL,\n `arr` array<struct<inside:int comment "in array">> NULL
410

‎regression-test/suites/datatype_p0/nested_types/ddl/test_struct_nested_comment_ddl.groovy‎

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,18 +33,23 @@ suite("test_struct_nested_comment_ddl", "p0") {
3333
PROPERTIES ("replication_num" = "1")
3434
"""
3535

36+
// Only compare column definitions; table properties depend on the deployment and FE configuration.
37+
def columnDefinitions = { row ->
38+
def ddl = row[1].toString()
39+
[row[0], ddl.substring(ddl.indexOf("(\n") + 2, ddl.indexOf("\n) ENGINE="))]
40+
}
41+
3642
// SHOW CREATE TABLE used to drop every nested field comment.
37-
qt_show_create "SHOW CREATE TABLE struct_nested_comment"
43+
quickRunTest("show_create", "SHOW CREATE TABLE struct_nested_comment", false, columnDefinitions)
3844
def createStmt = (sql "SHOW CREATE TABLE struct_nested_comment")[0][1].toString()
3945

4046
// The printed DDL still has to parse back.
4147
def replayStmt = createStmt.replace("`struct_nested_comment`", "`struct_nested_comment_replay`")
4248
sql replayStmt
43-
assertEquals(replayStmt, (sql "SHOW CREATE TABLE struct_nested_comment_replay")[0][1].toString())
49+
quickRunTest("show_create_replay", "SHOW CREATE TABLE struct_nested_comment_replay", false, columnDefinitions)
4450

4551
// CREATE TABLE LIKE re-parses the same generated DDL, so a dropped nested comment is
4652
// gone from the new table for good, not just hidden from the user.
4753
sql "CREATE TABLE struct_nested_comment_like LIKE struct_nested_comment"
48-
def likeStmt = (sql "SHOW CREATE TABLE struct_nested_comment_like")[0][1].toString()
49-
assertEquals(createStmt.replace("`struct_nested_comment`", "`struct_nested_comment_like`"), likeStmt)
54+
quickRunTest("show_create_like", "SHOW CREATE TABLE struct_nested_comment_like", false, columnDefinitions)
5055
}

0 commit comments

Comments
 (0)