mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-22 15:42:02 +00:00
Fix
This commit is contained in:
parent
4016530b99
commit
11ab1f1ae5
@ -268,13 +268,15 @@ public:
|
||||
out << current_element.getElement();
|
||||
auto output_str = out.str();
|
||||
ColumnString & col_str = assert_cast<ColumnString &>(dest);
|
||||
ColumnString::Chars & data = col_str.getChars();
|
||||
ColumnString::Offsets & offsets = col_str.getOffsets();
|
||||
|
||||
if (current_element.isString())
|
||||
{
|
||||
ReadBufferFromString buf(output_str);
|
||||
String unquoted_output_str;
|
||||
readJSONString(unquoted_output_str, buf);
|
||||
col_str.insertData(unquoted_output_str.data(), unquoted_output_str.size());
|
||||
readJSONStringInto(data, buf);
|
||||
data.push_back(0);
|
||||
offsets.push_back(data.size());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -98,4 +98,8 @@ SELECT id, JSON_QUERY(json, '$.friends[0 to 2]') FROM 01889_sql_json ORDER BY id
|
||||
0 ["Vasily", "Kostya"]
|
||||
1 ["Tihon", "Ernest"]
|
||||
2 ["Katya", "Anatoliy"]
|
||||
SELECT id, JSON_VALUE(json, '$.friends[0]') FROM 01889_sql_json ORDER BY id;
|
||||
0 Vasily
|
||||
1 Tihon
|
||||
2 Katya
|
||||
DROP TABLE 01889_sql_json;
|
||||
|
@ -55,4 +55,5 @@ INSERT INTO 01889_sql_json(id, json) VALUES(0, '{"name":"Ivan","surname":"Ivanov
|
||||
INSERT INTO 01889_sql_json(id, json) VALUES(1, '{"name":"Katya","surname":"Baltica","friends":["Tihon","Ernest","Innokentiy"]}');
|
||||
INSERT INTO 01889_sql_json(id, json) VALUES(2, '{"name":"Vitali","surname":"Brown","friends":["Katya","Anatoliy","Ivan","Oleg"]}');
|
||||
SELECT id, JSON_QUERY(json, '$.friends[0 to 2]') FROM 01889_sql_json ORDER BY id;
|
||||
SELECT id, JSON_VALUE(json, '$.friends[0]') FROM 01889_sql_json ORDER BY id;
|
||||
DROP TABLE 01889_sql_json;
|
||||
|
Loading…
Reference in New Issue
Block a user