This is an automated email from the ASF dual-hosted git repository. dataroaring pushed a commit to branch branch-3.0 in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-3.0 by this push: new 62bfeac5055 branch-3.0: [fix](variant) building index on the variant column is prohibited #49159 (#49844) 62bfeac5055 is described below commit 62bfeac50556244582e64189efdc8bd00c340557 Author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> AuthorDate: Wed Apr 9 10:26:43 2025 +0800 branch-3.0: [fix](variant) building index on the variant column is prohibited #49159 (#49844) Cherry-picked from #49159 Co-authored-by: Sun Chenyang <suncheny...@selectdb.com> --- .../apache/doris/alter/SchemaChangeHandler.java | 13 +++++++++++ .../suites/variant_p0/with_index/var_index.groovy | 25 ++++++++++++++++++++++ 2 files changed, 38 insertions(+) diff --git a/fe/fe-core/src/main/java/org/apache/doris/alter/SchemaChangeHandler.java b/fe/fe-core/src/main/java/org/apache/doris/alter/SchemaChangeHandler.java index 8ae7112e49b..162fb239b54 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/alter/SchemaChangeHandler.java +++ b/fe/fe-core/src/main/java/org/apache/doris/alter/SchemaChangeHandler.java @@ -2118,6 +2118,19 @@ public class SchemaChangeHandler extends AlterHandler { + 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()); diff --git a/regression-test/suites/variant_p0/with_index/var_index.groovy b/regression-test/suites/variant_p0/with_index/var_index.groovy index 82234bc3b5a..10cb0218ad2 100644 --- a/regression-test/suites/variant_p0/with_index/var_index.groovy +++ b/regression-test/suites/variant_p0/with_index/var_index.groovy @@ -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")) + } } \ No newline at end of file --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org