mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-03 13:02:00 +00:00
Minor changes in IP dictionary
This commit is contained in:
parent
608adc77ca
commit
6dcb38db3f
@ -159,7 +159,7 @@ static bool matchIPv6Subnet(const uint8_t * target, const uint8_t * addr, UInt8
|
||||
_mm_loadu_si128(reinterpret_cast<const __m128i *>(addr))));
|
||||
mask = ~mask;
|
||||
|
||||
if (mask)
|
||||
if (unlikely(mask))
|
||||
{
|
||||
auto offset = __builtin_ctz(mask);
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
||||
4 as ver,
|
||||
val
|
||||
FROM generateRandom('ipv4 UInt32, val Float32', 0, 30, 30)
|
||||
LIMIT 500000
|
||||
LIMIT 200000
|
||||
</create_query>
|
||||
|
||||
<create_query>
|
||||
@ -55,7 +55,7 @@
|
||||
</create_query>
|
||||
<create_query>
|
||||
INSERT INTO table_ip_from_dict
|
||||
SELECT ip, ver FROM dict_ip_trie_table
|
||||
SELECT splitByChar('/', ip )[1] as ip, ver FROM dict_ip_trie_table
|
||||
</create_query>
|
||||
|
||||
<query>
|
||||
@ -69,7 +69,7 @@
|
||||
</query>
|
||||
|
||||
<query>
|
||||
SELECT dictGetFloat32('default.dict_ip_trie', 'val', tuple(IPv4StringToNum(ip)))
|
||||
SELECT dictGetFloat32('default.dict_ip_trie', 'val', tuple(IPv6StringToNum(ip)))
|
||||
FROM table_ip_from_dict
|
||||
WHERE ver == 4
|
||||
LIMIT 500000
|
||||
|
@ -49,6 +49,7 @@
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
***ipv4 trie dict mask***
|
||||
1
|
||||
1
|
||||
|
@ -106,6 +106,7 @@ SELECT 1272 == asn AND 'RU' == cca2 FROM database_for_dict.table_from_ipv4_trie_
|
||||
WHERE prefix == '127.0.0.2/32';
|
||||
|
||||
SELECT 37 == COUNT(*) FROM database_for_dict.table_from_ipv4_trie_dict;
|
||||
SELECT 37 == COUNT(DISTINCT prefix) FROM database_for_dict.table_from_ipv4_trie_dict;
|
||||
|
||||
DROP DICTIONARY IF EXISTS database_for_dict.dict_ipv4_trie;
|
||||
DROP TABLE IF EXISTS database_for_dict.table_from_ipv4_trie_dict;
|
||||
|
Loading…
Reference in New Issue
Block a user