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 #34124 from ClickHouse/backport/22.1/33956
Backport #33956 to 22.1: Fix reading of nested tuples
- Loading branch information
Showing
4 changed files
with
64 additions
and
2 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,7 @@ | ||
{"endUserIDs":{"_experience":{"aaid":{"id":"id_1","namespace":{"code":"code_1"},"primary":1},"mcid":{"id":"id_2","namespace":{"code":"code_2"},"primary":2}}}} | ||
{"endUserIDs._experience":{"aaid":{"id":"id_1","namespace":{"code":"code_1"},"primary":1},"mcid":{"id":"id_2","namespace":{"code":"code_2"},"primary":2}}} | ||
{"endUserIDs._experience.aaid":{"id":"id_1","namespace":{"code":"code_1"},"primary":1}} | ||
{"endUserIDs._experience.aaid.id":"id_1"} | ||
{"endUserIDs._experience.aaid.namespace":{"code":"code_1"}} | ||
{"endUserIDs._experience.aaid.namespace.code":"code_1"} | ||
{"endUserIDs._experience.aaid.primary":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,38 @@ | ||
DROP TABLE IF EXISTS t_nested_tuple; | ||
|
||
CREATE TABLE t_nested_tuple | ||
( | ||
endUserIDs Tuple( | ||
_experience Tuple( | ||
aaid Tuple( | ||
id Nullable(String), | ||
namespace Tuple( | ||
code LowCardinality(Nullable(String)) | ||
), | ||
primary LowCardinality(Nullable(UInt8)) | ||
), | ||
mcid Tuple( | ||
id Nullable(String), | ||
namespace Tuple( | ||
code LowCardinality(Nullable(String)) | ||
), | ||
primary LowCardinality(Nullable(UInt8)) | ||
) | ||
) | ||
) | ||
) | ||
ENGINE = MergeTree ORDER BY tuple(); | ||
|
||
SET output_format_json_named_tuples_as_objects = 1; | ||
|
||
INSERT INTO t_nested_tuple FORMAT JSONEachRow {"endUserIDs":{"_experience":{"aaid":{"id":"id_1","namespace":{"code":"code_1"},"primary":1},"mcid":{"id":"id_2","namespace":{"code":"code_2"},"primary":2}}}}; | ||
|
||
SELECT * FROM t_nested_tuple FORMAT JSONEachRow; | ||
SELECT endUserIDs._experience FROM t_nested_tuple FORMAT JSONEachRow; | ||
SELECT endUserIDs._experience.aaid FROM t_nested_tuple FORMAT JSONEachRow; | ||
SELECT endUserIDs._experience.aaid.id FROM t_nested_tuple FORMAT JSONEachRow; | ||
SELECT endUserIDs._experience.aaid.namespace FROM t_nested_tuple FORMAT JSONEachRow; | ||
SELECT endUserIDs._experience.aaid.namespace.code FROM t_nested_tuple FORMAT JSONEachRow; | ||
SELECT endUserIDs._experience.aaid.primary FROM t_nested_tuple FORMAT JSONEachRow; | ||
|
||
DROP TABLE t_nested_tuple; |