Skip to content

Commit

Permalink
[SchemaChange](RowStore) forbid schema change to set property `store_…
Browse files Browse the repository at this point in the history
…row_column` for agg and mor table
  • Loading branch information
eldenmoon committed Jan 14, 2025
1 parent 06922c8 commit 8f44e09
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1381,6 +1381,11 @@ private void createJob(String rawSql, long dbId, OlapTable olapTable, Map<Long,
List<String> oriRowStoreColumns = olapTable.getTableProperty().getCopiedRowStoreColumns();
if ((oriRowStoreColumns != null && !oriRowStoreColumns.equals(rsColumns))
|| storeRowColumn != olapTable.storeRowColumn()) {
// only support mow and duplicate model
if (!(olapTable.getKeysType() == KeysType.DUP_KEYS
|| olapTable.getEnableUniqueKeyMergeOnWrite())) {
throw new DdlException("`store_row_column` only support duplicate model or mow model");
}
hasRowStoreChanged = true;
}
}
Expand Down
35 changes: 34 additions & 1 deletion regression-test/suites/point_query_p0/load.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ suite("test_load_and_schema_change_row_store", "p0") {
UNIQUE KEY(`k1`)
COMMENT 'OLAP'
DISTRIBUTED BY HASH(`k1`) BUCKETS 10
PROPERTIES("replication_num" = "1");
PROPERTIES("replication_num" = "1", "enable_unique_key_merge_on_write" = "true");
"""

wait_job_done.call("tbl_scalar_types_dup")
Expand Down Expand Up @@ -162,4 +162,37 @@ suite("test_load_and_schema_change_row_store", "p0") {
}
qt_sql "select /*+ SET_VAR(enable_nereids_planner=true,enable_short_circuit_query_access_column_store=false)*/ k1, c_decimalv3 from tbl_scalar_types_dup_1 where k1 = -2147303679"
sql "set enable_short_circuit_query_access_column_store = true"


sql "DROP TABLE IF EXISTS tbl_scalar_types_uk_not_mow"
sql """
CREATE TABLE IF NOT EXISTS tbl_scalar_types_uk_not_mow (
`k1` bigint(11) NULL,
`c_string` text NULL
) ENGINE=OLAP
UNIQUE KEY(`k1`)
COMMENT 'OLAP'
DISTRIBUTED BY HASH(`k1`) BUCKETS 10
PROPERTIES("replication_num" = "1", "enable_unique_key_merge_on_write" = "false");
"""
test {
sql """alter table tbl_scalar_types_uk_not_mow set ("store_row_column" = "true")"""
exception("`store_row_column` only support duplicate model or mow model")
}

sql "DROP TABLE IF EXISTS tbl_scalar_types_agg"
sql """
CREATE TABLE IF NOT EXISTS tbl_scalar_types_agg(
`k1` bigint(11) NULL,
`c_string` text REPLACE_IF_NOT_NULL
) ENGINE=OLAP
AGGREGATE KEY(`k1`)
COMMENT 'OLAP'
DISTRIBUTED BY HASH(`k1`) BUCKETS 10
PROPERTIES("replication_num" = "1");
"""
test {
sql """alter table tbl_scalar_types_agg set ("store_row_column" = "true")"""
exception("`store_row_column` only support duplicate model or mow model")
}
}
2 changes: 1 addition & 1 deletion regression-test/suites/point_query_p0/load_ck.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ suite("test_load_and_schema_change_row_store_ck", "p0") {
CLUSTER BY(c_datev2, c_date, c_largeint, c_tinyint, c_varchar, c_char, c_datetimev2, c_int, c_decimalv3, k1, c_decimal)
COMMENT 'OLAP'
DISTRIBUTED BY HASH(`k1`) BUCKETS 10
PROPERTIES("replication_num" = "1");
PROPERTIES("replication_num" = "1", "enable_unique_key_merge_on_write" = "true");
"""

wait_job_done.call(testTable)
Expand Down
2 changes: 1 addition & 1 deletion regression-test/suites/point_query_p0/test_rowstore.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ suite("test_rowstore", "p0,nonConcurrent") {
"storage_format" = "V2"
)
"""
sql "select /*+ SET_VAR(enable_nereids_planner=true)*/ * from table_with_column_group where k1 = 1"
sql "select /*+ SET_VAR(enable_nereids_planner=true, enable_short_circuit_query_access_column_store=true)*/ * from table_with_column_group where k1 = 1"

sql """DROP TABLE IF EXISTS rs_query"""
sql "set enable_decimal256 = true"
Expand Down

0 comments on commit 8f44e09

Please sign in to comment.