-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
IPAddressDictionary fixed, test fixed, porting ClickHouse/ClickHouse#…
- Loading branch information
lijianan
committed
Dec 7, 2023
1 parent
3f218c8
commit eb46359
Showing
3 changed files
with
53 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
tests/queries_ported/0_stateless/02522_ip_trie_dictionary.reference
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
52.3759 | ||
1 |
32 changes: 32 additions & 0 deletions
32
tests/queries_ported/0_stateless/02522_ip_trie_dictionary.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
drop stream if exists geoip_t; | ||
|
||
create stream if not exists geoip_t ( | ||
cidr string, | ||
latitude float64, | ||
longitude float64, | ||
country_code string, | ||
state string, | ||
city string | ||
) engine = MergeTree primary key cidr; | ||
|
||
insert into geoip_t values ('188.166.84.125',52.3759,4.8975,'NL','North Holland','Amsterdam'); | ||
|
||
drop dictionary if exists geoip; | ||
|
||
CREATE DICTIONARY geoip ( | ||
cidr string, | ||
latitude float64, | ||
longitude float64, | ||
country_code string, | ||
state string, | ||
city string | ||
) PRIMARY KEY cidr | ||
SOURCE (ClickHouse (table 'geoip_t' user 'proton' password 'proton@t+' )) | ||
LIFETIME (MIN 300 MAX 360) | ||
LAYOUT (IP_TRIE()); | ||
|
||
select dict_get('geoip', 'latitude', to_ipv4('188.166.84.125')); | ||
select dict_get_or_default('geoip', 'latitude', to_ipv4('188.166.84.111'), 1.0); | ||
|
||
drop stream if exists geoip_t; | ||
drop dictionary if exists geoip; |