Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2507,6 +2507,16 @@ private boolean createOlapTable(Database db, CreateTableStmt stmt) throws UserEx
// use light schema change optimization
olapTable.setEnableLightSchemaChange(enableLightSchemaChange);

// check if light schema change is disabled, variant type rely on light schema change
if (!enableLightSchemaChange) {
for (Column column : baseSchema) {
if (column.getType().isVariantType()) {
throw new DdlException("Variant type rely on light schema change, "
+ " please use light_schema_change = true.");
}
}
}

boolean disableAutoCompaction = false;
try {
disableAutoCompaction = PropertyAnalyzer.analyzeDisableAutoCompaction(properties);
Expand Down
16 changes: 16 additions & 0 deletions regression-test/suites/variant_p0/load.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -446,6 +446,22 @@ suite("regression_test_variant", "p0"){
exception("Invalid type for variant column: 36")
}

test {
sql """
create table var(
`key` int,
`content` variant
)
DUPLICATE KEY(`key`)
distributed by hash(`key`) buckets 8
properties(
"replication_allocation" = "tag.location.default: 1",
"light_schema_change" = "false"
);
"""
exception("errCode = 2, detailMessage = Variant type rely on light schema change")
}

} finally {
// reset flags
}
Expand Down