mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-24 00:22:29 +00:00
Add support for Chinese components in Nested data types
This commit is contained in:
parent
1e9fbdb02c
commit
b26feb2b19
@ -34,41 +34,15 @@ std::string concatenateName(const std::string & nested_table_name, const std::st
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/** Name can be treated as compound if and only if both parts are simple identifiers.
|
/** Name can be treated as compound if it contains dot (.) in the middle.
|
||||||
*/
|
*/
|
||||||
std::pair<std::string, std::string> splitName(const std::string & name)
|
std::pair<std::string, std::string> splitName(const std::string & name)
|
||||||
{
|
{
|
||||||
const char * begin = name.data();
|
auto idx = name.find_first_of('.');
|
||||||
const char * pos = begin;
|
if (idx == std::string::npos || idx == 0 || idx + 1 == name.size())
|
||||||
const char * end = begin + name.size();
|
|
||||||
|
|
||||||
if (pos >= end || !isValidIdentifierBegin(*pos))
|
|
||||||
return {name, {}};
|
return {name, {}};
|
||||||
|
|
||||||
++pos;
|
return {name.substr(0, idx), name.substr(idx + 1)};
|
||||||
|
|
||||||
while (pos < end && isWordCharASCII(*pos))
|
|
||||||
++pos;
|
|
||||||
|
|
||||||
if (pos >= end || *pos != '.')
|
|
||||||
return {name, {}};
|
|
||||||
|
|
||||||
const char * first_end = pos;
|
|
||||||
++pos;
|
|
||||||
const char * second_begin = pos;
|
|
||||||
|
|
||||||
if (pos >= end || !isValidIdentifierBegin(*pos))
|
|
||||||
return {name, {}};
|
|
||||||
|
|
||||||
++pos;
|
|
||||||
|
|
||||||
while (pos < end && isWordCharASCII(*pos))
|
|
||||||
++pos;
|
|
||||||
|
|
||||||
if (pos != end)
|
|
||||||
return {name, {}};
|
|
||||||
|
|
||||||
return {{ begin, first_end }, { second_begin, end }};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
12
tests/queries/0_stateless/01937_nested_chinese.reference
Normal file
12
tests/queries/0_stateless/01937_nested_chinese.reference
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
id String
|
||||||
|
products.产品 Array(Array(String))
|
||||||
|
products.销量 Array(Array(Int32))
|
||||||
|
id String
|
||||||
|
products.产品 Array(Array(String))
|
||||||
|
products.销量 Array(Array(Int32))
|
||||||
|
id String
|
||||||
|
products.产品 Array(String)
|
||||||
|
products.销量 Array(Int32)
|
||||||
|
p.产品 Array(String)
|
||||||
|
p.销量 Array(Int32)
|
||||||
|
0
|
8
tests/queries/0_stateless/01937_nested_chinese.sql
Normal file
8
tests/queries/0_stateless/01937_nested_chinese.sql
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
CREATE TEMPORARY TABLE test (`id` String, `products` Nested (`产品` Array(String), `销量` Array(Int32)));
|
||||||
|
|
||||||
|
DESCRIBE test;
|
||||||
|
DESCRIBE (SELECT * FROM test);
|
||||||
|
DESCRIBE (SELECT * FROM test ARRAY JOIN products);
|
||||||
|
DESCRIBE (SELECT p.`产品`, p.`销量` FROM test ARRAY JOIN products AS p);
|
||||||
|
SELECT * FROM test ARRAY JOIN products;
|
||||||
|
SELECT count() FROM (SELECT * FROM test ARRAY JOIN products);
|
Loading…
Reference in New Issue
Block a user