This is an automated email from the ASF dual-hosted git repository. yiguolei pushed a commit to branch branch-2.1 in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-2.1 by this push: new 76613668f7b [fix](bloomFilter)fix data type supported behavior same in FE and BE … (#45178) 76613668f7b is described below commit 76613668f7bcbbbff08bc96109a27089e3b02db4 Author: amory <wangqian...@selectdb.com> AuthorDate: Wed Dec 11 18:04:04 2024 +0800 [fix](bloomFilter)fix data type supported behavior same in FE and BE … (#45178) --- .../main/java/org/apache/doris/catalog/Column.java | 14 +++++++++ .../apache/doris/common/util/PropertyAnalyzer.java | 5 +--- .../bloom_filter_p0/test_bloom_filter.groovy | 33 ++++++++++++++++++++++ 3 files changed, 48 insertions(+), 4 deletions(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/catalog/Column.java b/fe/fe-core/src/main/java/org/apache/doris/catalog/Column.java index 7d750dc9970..3b6d487dddc 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/catalog/Column.java +++ b/fe/fe-core/src/main/java/org/apache/doris/catalog/Column.java @@ -428,6 +428,20 @@ public class Column implements Writable, GsonPostProcessable { || aggregationType == AggregateType.NONE) && nameEquals(VERSION_COL, true); } + // now we only support BloomFilter on (same behavior with BE): + // smallint/int/bigint/largeint + // string/varchar/char/variant + // date/datetime/datev2/datetimev2 + // decimal/decimal32/decimal64/decimal128I/decimal256 + // ipv4/ipv6 + public boolean isSupportBloomFilter() { + PrimitiveType pType = getDataType(); + return (pType == PrimitiveType.SMALLINT || pType == PrimitiveType.INT + || pType == PrimitiveType.BIGINT || pType == PrimitiveType.LARGEINT) + || pType.isCharFamily() || pType.isDateType() || pType.isVariantType() + || pType.isDecimalV2Type() || pType.isDecimalV3Type() || pType.isIPType(); + } + public PrimitiveType getDataType() { return type.getPrimitiveType(); } diff --git a/fe/fe-core/src/main/java/org/apache/doris/common/util/PropertyAnalyzer.java b/fe/fe-core/src/main/java/org/apache/doris/common/util/PropertyAnalyzer.java index 8967e928d63..9d948f2e5c8 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/common/util/PropertyAnalyzer.java +++ b/fe/fe-core/src/main/java/org/apache/doris/common/util/PropertyAnalyzer.java @@ -538,11 +538,8 @@ public class PropertyAnalyzer { if (column.getName().equalsIgnoreCase(bfColumn)) { PrimitiveType type = column.getDataType(); - // tinyint/float/double columns don't support // key columns and none/replace aggregate non-key columns support - if (type == PrimitiveType.TINYINT || type == PrimitiveType.FLOAT - || type == PrimitiveType.DOUBLE || type == PrimitiveType.BOOLEAN - || type.isComplexType()) { + if (!column.isSupportBloomFilter()) { throw new AnalysisException(type + " is not supported in bloom filter index. " + "invalid column: " + bfColumn); } else if (keysType != KeysType.AGG_KEYS || column.isKey()) { diff --git a/regression-test/suites/bloom_filter_p0/test_bloom_filter.groovy b/regression-test/suites/bloom_filter_p0/test_bloom_filter.groovy index 89140593d0e..23e1c7ed596 100644 --- a/regression-test/suites/bloom_filter_p0/test_bloom_filter.groovy +++ b/regression-test/suites/bloom_filter_p0/test_bloom_filter.groovy @@ -115,4 +115,37 @@ suite("test_bloom_filter") { sql """ALTER TABLE ${test_map_tb} SET("bloom_filter_columns" = "k1,m1")""" exception "not supported in bloom filter index" } + + // bloom filter index for json column + def test_json_tb = "test_json_bloom_filter_tb" + sql """DROP TABLE IF EXISTS ${test_json_tb}""" + + test { + sql """CREATE TABLE IF NOT EXISTS ${test_json_tb} ( + `k1` int(11) NOT NULL, + `j1` json NOT NULL + ) ENGINE=OLAP + DUPLICATE KEY(`k1`) + DISTRIBUTED BY HASH(`k1`) BUCKETS 5 + PROPERTIES ( + "replication_num" = "1", + "bloom_filter_columns" = "k1,j1" + )""" + exception "not supported in bloom filter index" + } + + sql """CREATE TABLE IF NOT EXISTS ${test_json_tb} ( + `k1` int(11) NOT NULL, + `j1` json NOT NULL + ) ENGINE=OLAP + DUPLICATE KEY(`k1`) + DISTRIBUTED BY HASH(`k1`) BUCKETS 5 + PROPERTIES ( + "replication_num" = "1", + "bloom_filter_columns" = "k1" + )""" + test { + sql """ALTER TABLE ${test_json_tb} SET("bloom_filter_columns" = "k1,j1")""" + exception "not supported in bloom filter index" + } } --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org