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 a5505133ca2852..52d0d33f1e9d13 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 @@ -448,6 +448,20 @@ public boolean isVersionColumn() { || 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 a34827303ec055..90e3c45497bb7d 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 @@ -642,11 +642,8 @@ public static Set analyzeBloomFilterColumns(Map properti 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 89140593d0edf0..23e1c7ed596f62 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" + } }