mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-09-20 00:30:49 +00:00
Merge pull request #34228 from CurtizJ/fix-subcolumns-with-dots
Fix reading of subcolumns with dots in their names
This commit is contained in:
commit
b633a916af
@ -167,8 +167,10 @@ String getNameForSubstreamPath(
|
||||
/// Because nested data may be represented not by Array of Tuple,
|
||||
/// but by separate Array columns with names in a form of a.b,
|
||||
/// and name is encoded as a whole.
|
||||
stream_name += (escape_tuple_delimiter && it->escape_tuple_delimiter ?
|
||||
escapeForFileName(".") : ".") + escapeForFileName(it->tuple_element_name);
|
||||
if (escape_tuple_delimiter && it->escape_tuple_delimiter)
|
||||
stream_name += escapeForFileName("." + it->tuple_element_name);
|
||||
else
|
||||
stream_name += "." + it->tuple_element_name;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,7 @@
|
||||
[1] [[1]]
|
||||
[[1]]
|
||||
[(1,[1])]
|
||||
[[1]]
|
||||
(('a',1),'b')
|
||||
a 1
|
||||
a b
|
33
tests/queries/0_stateless/02191_nested_with_dots.sql
Normal file
33
tests/queries/0_stateless/02191_nested_with_dots.sql
Normal file
@ -0,0 +1,33 @@
|
||||
DROP TABLE IF EXISTS t_nested_with_dots;
|
||||
|
||||
CREATE TABLE t_nested_with_dots (n Nested(id UInt64, `values.id` Array(UInt64)))
|
||||
ENGINE = MergeTree ORDER BY tuple();
|
||||
|
||||
INSERT INTO t_nested_with_dots VALUES ([1], [[1]]);
|
||||
|
||||
SELECT * FROM t_nested_with_dots;
|
||||
SELECT n.values.id FROM t_nested_with_dots;
|
||||
|
||||
DROP TABLE IF EXISTS t_nested_with_dots;
|
||||
SET flatten_nested = 0;
|
||||
|
||||
CREATE TABLE t_nested_with_dots (n Nested(id UInt64, `values.id` Array(UInt64)))
|
||||
ENGINE = MergeTree ORDER BY tuple();
|
||||
|
||||
INSERT INTO t_nested_with_dots VALUES ([(1, [1])]);
|
||||
|
||||
SELECT * FROM t_nested_with_dots;
|
||||
SELECT n.values.id FROM t_nested_with_dots;
|
||||
|
||||
DROP TABLE IF EXISTS t_nested_with_dots;
|
||||
|
||||
CREATE TABLE t_nested_with_dots (`t.t2` Tuple(`t3.t4.t5` Tuple(`s1.s2` String, `u1.u2` UInt64), `s3.s4.s5` String))
|
||||
ENGINE = MergeTree ORDER BY tuple();
|
||||
|
||||
INSERT INTO t_nested_with_dots VALUES ((('a', 1), 'b'));
|
||||
|
||||
SELECT * FROM t_nested_with_dots;
|
||||
SELECT t.t2.t3.t4.t5.s1.s2, t.t2.t3.t4.t5.u1.u2 FROM t_nested_with_dots;
|
||||
SELECT t.t2.t3.t4.t5.s1.s2, t.t2.s3.s4.s5 FROM t_nested_with_dots;
|
||||
|
||||
DROP TABLE IF EXISTS t_nested_with_dots;
|
Loading…
Reference in New Issue
Block a user