forked from StarRocks/starrocks
-
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.
[Enhancement]dict_merge can process data from plain reader
Signed-off-by: zombee0 <[email protected]>
- Loading branch information
Showing
6 changed files
with
113 additions
and
6 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
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,41 @@ | ||
-- name: testDictMerge | ||
CREATE TABLE `test_dict_merge` ( | ||
`id` int NULL COMMENT "", | ||
`city` string NOT NULL COMMENT "", | ||
`city_null` string NULL COMMENT "", | ||
`city_array` array<string> NOT NULL COMMENT "", | ||
`city_array_null` array<string> NULL COMMENT "" | ||
) ENGINE=OLAP | ||
DUPLICATE KEY(`id`) | ||
DISTRIBUTED BY HASH(`id`) BUCKETS 4 | ||
PROPERTIES ( | ||
"replication_num" = "1", | ||
"enable_persistent_index" = "false", | ||
"replicated_storage" = "true", | ||
"compression" = "LZ4" | ||
); | ||
-- result: | ||
-- !result | ||
insert into test_dict_merge values | ||
(1, "beijing", "beijing", ["beijing", "shanghai"], NULL), | ||
(1, "beijing", NULL, ["shenzhen", "shanghai"], ["shenzhen", "shanghai"]), | ||
(1, "shanghai", "shanghai", ["shenzhen", NULL], ["shenzhen", NULL]), | ||
(1, "shanghai", NULL, ["beijing", NULL, "shanghai"], NULL); | ||
-- result: | ||
-- !result | ||
select dict_merge(city) from test_dict_merge; | ||
-- result: | ||
{"2":{"lst":["str",2,"YmVpamluZw","c2hhbmdoYWk"]},"3":{"lst":["i32",2,1,2]}} | ||
-- !result | ||
select dict_merge(city_null) from test_dict_merge; | ||
-- result: | ||
{"2":{"lst":["str",2,"YmVpamluZw","c2hhbmdoYWk"]},"3":{"lst":["i32",2,1,2]}} | ||
-- !result | ||
select dict_merge(city_array) from test_dict_merge; | ||
-- result: | ||
{"2":{"lst":["str",3,"YmVpamluZw","c2hhbmdoYWk","c2hlbnpoZW4"]},"3":{"lst":["i32",3,1,2,3]}} | ||
-- !result | ||
select dict_merge(city_array_null) from test_dict_merge; | ||
-- result: | ||
{"2":{"lst":["str",2,"c2hhbmdoYWk","c2hlbnpoZW4"]},"3":{"lst":["i32",2,1,2]}} | ||
-- !result |
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,27 @@ | ||
-- name: testDictMerge | ||
CREATE TABLE `test_dict_merge` ( | ||
`id` int NULL COMMENT "", | ||
`city` string NOT NULL COMMENT "", | ||
`city_null` string NULL COMMENT "", | ||
`city_array` array<string> NOT NULL COMMENT "", | ||
`city_array_null` array<string> NULL COMMENT "" | ||
) ENGINE=OLAP | ||
DUPLICATE KEY(`id`) | ||
DISTRIBUTED BY HASH(`id`) BUCKETS 4 | ||
PROPERTIES ( | ||
"replication_num" = "1", | ||
"enable_persistent_index" = "false", | ||
"replicated_storage" = "true", | ||
"compression" = "LZ4" | ||
); | ||
|
||
insert into test_dict_merge values | ||
(1, "beijing", "beijing", ["beijing", "shanghai"], NULL), | ||
(1, "beijing", NULL, ["shenzhen", "shanghai"], ["shenzhen", "shanghai"]), | ||
(1, "shanghai", "shanghai", ["shenzhen", NULL], ["shenzhen", NULL]), | ||
(1, "shanghai", NULL, ["beijing", NULL, "shanghai"], NULL); | ||
|
||
select dict_merge(city) from test_dict_merge; | ||
select dict_merge(city_null) from test_dict_merge; | ||
select dict_merge(city_array) from test_dict_merge; | ||
select dict_merge(city_array_null) from test_dict_merge; |
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