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 @@ -2118,6 +2118,19 @@ public int getAsInt() {
+ existedIdx.getIndexName() + " of type " + existedIdx.getIndexType()
+ " does not support lightweight index changes.");
}
for (Column column : olapTable.getBaseSchema()) {
if (!column.getType().isVariantType()) {
continue;
}
// variant type column can not support for building index
for (String indexColumn : existedIdx.getColumns()) {
if (column.getName().equalsIgnoreCase(indexColumn)) {
throw new DdlException("BUILD INDEX operation failed: The "
+ indexDef.getIndexName() + " index can not be built on the "
+ indexColumn + " column, because it is a variant type column.");
}
}
}
index = existedIdx.clone();
if (indexDef.getPartitionNames().isEmpty()) {
invertedIndexOnPartitions.put(index.getIndexId(), olapTable.getPartitionNames());
Expand Down
25 changes: 25 additions & 0 deletions regression-test/suites/variant_p0/with_index/var_index.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -106,4 +106,29 @@ suite("regression_test_variant_var_index", "p0, nonConcurrent"){
"""
sql """ALTER TABLE var_index ADD INDEX idx_var(v) USING INVERTED"""
sql """ set disable_inverted_index_v1_for_variant = true """

try {
sql """ build index idx_var on var_index"""
} catch (Exception e) {
log.info(e.getMessage())
assertTrue(e.getMessage().contains("The idx_var index can not be built on the v column, because it is a variant type column"))
}

sql "DROP TABLE IF EXISTS var_index"
sql """
CREATE TABLE IF NOT EXISTS var_index (
k bigint,
v variant
)
DUPLICATE KEY(`k`)
DISTRIBUTED BY HASH(k) BUCKETS 1
properties("replication_num" = "1", "disable_auto_compaction" = "true", "inverted_index_storage_format" = "V2");
"""
sql """ALTER TABLE var_index ADD INDEX idx_var(v) USING INVERTED"""
try {
sql """ build index idx_var on var_index"""
} catch (Exception e) {
log.info(e.getMessage())
assertTrue(e.getMessage().contains("The idx_var index can not be built on the v column, because it is a variant type column"))
}
}
Loading