Minor changes in IP dictionary

This commit is contained in:
vdimir 2020-11-16 21:08:31 +03:00
parent 608adc77ca
commit 6dcb38db3f
No known key found for this signature in database
GPG Key ID: 4F25F52AFAF0C2C0
4 changed files with 6 additions and 4 deletions

View File

@ -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);

View File

@ -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

View File

@ -49,6 +49,7 @@
1
1
1
1
***ipv4 trie dict mask***
1
1

View File

@ -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;