forked from ClickHouse/ClickHouse
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request ClickHouse#51756 from ClickHouse/fix-ip-dict
Support IPv4 and IPv6 as dictionary attributes
- Loading branch information
Showing
3 changed files
with
18 additions
and
1 deletion.
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
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 @@ | ||
('::2.2.2.2','2.2.2.2') | ||
('::1.1.1.1','1.1.1.1') |
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,13 @@ | ||
CREATE TABLE src ( id UInt64, ip4 IPv4, ip6 IPv6 ) Engine=Memory AS | ||
SELECT * FROM VALUES( (1, '1.1.1.1', '::1.1.1.1'), (2, '2.2.2.2', '::2.2.2.2') ); | ||
|
||
CREATE DICTIONARY dict ( id UInt64, ip4 IPv4, ip6 IPv6 ) | ||
PRIMARY KEY id | ||
LAYOUT(HASHED()) | ||
SOURCE (CLICKHOUSE ( table src)) | ||
lifetime ( 10); | ||
|
||
SELECT dictGet('dict', ('ip6', 'ip4'), arrayJoin([2,1])); | ||
|
||
DROP DICTIONARY dict; | ||
DROP TABLE src; |