diff --git a/fe/fe-core/src/main/java/org/apache/doris/analysis/InvertedIndexUtil.java b/fe/fe-core/src/main/java/org/apache/doris/analysis/InvertedIndexUtil.java index f1e73c75ca8c55..1f723647784f9b 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/analysis/InvertedIndexUtil.java +++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/InvertedIndexUtil.java @@ -316,7 +316,7 @@ public static void checkInvertedIndexProperties(Map properties, } if (dictCompression != null) { - if (!colType.isStringType()) { + if (!colType.isStringType() && !colType.isVariantType()) { throw new AnalysisException("dict_compression can only be set for StringType columns. type: " + colType); } diff --git a/regression-test/suites/inverted_index_p0/test_inverted_index_v3.groovy b/regression-test/suites/inverted_index_p0/test_inverted_index_v3.groovy index 82389d84e3cd67..6ee92c4083b689 100644 --- a/regression-test/suites/inverted_index_p0/test_inverted_index_v3.groovy +++ b/regression-test/suites/inverted_index_p0/test_inverted_index_v3.groovy @@ -140,4 +140,32 @@ suite("test_inverted_index_v3", "p0"){ } finally { } + + sql """ + CREATE TABLE `t1` ( + `id` int NOT NULL, + `v` variant , + INDEX idx_v (`v`) USING INVERTED PROPERTIES("dict_compression" = "true", "lower_case" = "true", "parser" = "unicode", "support_phrase" = "true", "field_pattern" = "key") + ) ENGINE=OLAP + DUPLICATE KEY(`id`) + DISTRIBUTED BY HASH(`id`) BUCKETS 1 + PROPERTIES ( + "replication_allocation" = "tag.location.default: 1", + "inverted_index_storage_format" = "V3" + ); + """ + + sql """ + CREATE TABLE `t2` ( + `id` int NOT NULL, + `v` variant, + INDEX idx_v (`v`) USING INVERTED PROPERTIES("dict_compression" = "true", "lower_case" = "true", "parser" = "unicode", "support_phrase" = "true") + ) ENGINE=OLAP + DUPLICATE KEY(`id`) + DISTRIBUTED BY HASH(`id`) BUCKETS 1 + PROPERTIES ( + "replication_allocation" = "tag.location.default: 1", + "inverted_index_storage_format" = "V3" + ); + """ } \ No newline at end of file