mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-27 10:02:01 +00:00
allow bloom filter for IPv4 and IPv6
This commit is contained in:
parent
e999f66234
commit
e433c26cf9
@ -94,6 +94,8 @@ struct BloomFilterHash
|
||||
else if (which.isFloat32()) return build_hash_column(getNumberTypeHash<Float64, Float64>(field));
|
||||
else if (which.isFloat64()) return build_hash_column(getNumberTypeHash<Float64, Float64>(field));
|
||||
else if (which.isUUID()) return build_hash_column(getNumberTypeHash<UUID, UUID>(field));
|
||||
else if (which.isIPv4()) return build_hash_column(getNumberTypeHash<IPv4, IPv4>(field));
|
||||
else if (which.isIPv6()) return build_hash_column(getNumberTypeHash<IPv6, IPv6>(field));
|
||||
else if (which.isString()) return build_hash_column(getStringTypeHash(field));
|
||||
else if (which.isFixedString()) return build_hash_column(getFixedStringTypeHash(field, data_type));
|
||||
else throw Exception(ErrorCodes::BAD_ARGUMENTS, "Unexpected type {} of bloom filter index.", data_type->getName());
|
||||
@ -156,6 +158,8 @@ struct BloomFilterHash
|
||||
else if (which.isFloat32()) getNumberTypeHash<Float32, is_first>(column, vec, pos);
|
||||
else if (which.isFloat64()) getNumberTypeHash<Float64, is_first>(column, vec, pos);
|
||||
else if (which.isUUID()) getNumberTypeHash<UUID, is_first>(column, vec, pos);
|
||||
else if (which.isIPv4()) getNumberTypeHash<IPv4, is_first>(column, vec, pos);
|
||||
else if (which.isIPv6()) getNumberTypeHash<IPv6, is_first>(column, vec, pos);
|
||||
else if (which.isString()) getStringTypeHash<is_first>(column, vec, pos);
|
||||
else if (which.isFixedString()) getStringTypeHash<is_first>(column, vec, pos);
|
||||
else throw Exception(ErrorCodes::BAD_ARGUMENTS, "Unexpected type {} of bloom filter index.", data_type->getName());
|
||||
|
@ -88,7 +88,8 @@ static void assertIndexColumnsType(const Block & header)
|
||||
WhichDataType which(actual_type);
|
||||
|
||||
if (!which.isUInt() && !which.isInt() && !which.isString() && !which.isFixedString() && !which.isFloat() &&
|
||||
!which.isDate() && !which.isDateTime() && !which.isDateTime64() && !which.isEnum() && !which.isUUID())
|
||||
!which.isDate() && !which.isDateTime() && !which.isDateTime64() && !which.isEnum() && !which.isUUID() &&
|
||||
!which.isIPv4() && !which.isIPv6())
|
||||
throw Exception(ErrorCodes::ILLEGAL_COLUMN, "Unexpected type {} of bloom filter index.", type->getName());
|
||||
}
|
||||
}
|
||||
|
1
tests/queries/0_stateless/02559_ip_types_bloom.reference
Normal file
1
tests/queries/0_stateless/02559_ip_types_bloom.reference
Normal file
@ -0,0 +1 @@
|
||||
1 1.1.1.1 ::1
|
18
tests/queries/0_stateless/02559_ip_types_bloom.sql
Normal file
18
tests/queries/0_stateless/02559_ip_types_bloom.sql
Normal file
@ -0,0 +1,18 @@
|
||||
DROP TABLE IF EXISTS ip_bloom;
|
||||
|
||||
CREATE TABLE ip_bloom
|
||||
(
|
||||
`a` UInt32,
|
||||
`ip4` Nullable(IPv4),
|
||||
`ip6` Nullable(IPv6),
|
||||
INDEX x4 ip4 TYPE bloom_filter(0.1) GRANULARITY 3,
|
||||
INDEX x6 ip6 TYPE bloom_filter(0.1) GRANULARITY 3
|
||||
)
|
||||
ENGINE = MergeTree
|
||||
ORDER BY a;
|
||||
|
||||
INSERT INTO ip_bloom VALUES (1, '1.1.1.1', '::1');
|
||||
|
||||
SELECT * FROM ip_bloom;
|
||||
|
||||
DROP TABLE ip_bloom;
|
Loading…
Reference in New Issue
Block a user