From 92d245fa8c9e76ad3bbe4a5fea44f7a93885c757 Mon Sep 17 00:00:00 2001 From: yangsiyu Date: Wed, 24 Sep 2025 17:12:42 +0800 Subject: [PATCH] [fix](inverted index) support dict_compression configuration for variant type --- .../doris/analysis/InvertedIndexUtil.java | 2 +- .../test_inverted_index_v3.groovy | 28 +++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) 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