Skip to content

Commit

Permalink
[Fix](Variant Type) forbit distribution info contains variant columns (
Browse files Browse the repository at this point in the history
  • Loading branch information
eldenmoon authored Apr 17, 2024
1 parent a106e45 commit 21230a3
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2177,6 +2177,12 @@ private void createOlapTable(Database db, CreateTableStmt stmt) throws UserExcep
Preconditions.checkNotNull(distributionDesc);
DistributionInfo defaultDistributionInfo = distributionDesc.toDistributionInfo(baseSchema);

if (defaultDistributionInfo instanceof HashDistributionInfo
&& ((HashDistributionInfo) defaultDistributionInfo).getDistributionColumns()
.stream().anyMatch(column -> column.getType().isVariantType())) {
throw new DdlException("Hash distribution info should not contain variant columns");
}

// calc short key column count
short shortKeyColumnCount = Env.calcShortKeyColumnCount(baseSchema, stmt.getProperties(), isKeysRequired);
if (LOG.isDebugEnabled()) {
Expand Down
12 changes: 12 additions & 0 deletions regression-test/suites/variant_p0/load.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,18 @@ suite("regression_test_variant", "nonConcurrent"){
exception("errCode = 2, detailMessage = Doris hll, bitmap, array, map, struct, jsonb, variant column must use with specific function, and don't support filter, group by or order by")
}

test {
sql """
create table var(
`content` variant
)distributed by hash(`content`) buckets 8
properties(
"replication_allocation" = "tag.location.default: 1"
);
"""
exception("errCode = 2, detailMessage = Hash distribution info should not contain variant columns")
}

// 13. sparse columns
table_name = "sparse_columns"
create_table table_name
Expand Down

0 comments on commit 21230a3

Please sign in to comment.