mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 15:12:02 +00:00
Fix handling mixed const/non-const cases.
This commit is contained in:
parent
b7d0add7a8
commit
63b319404b
@ -120,11 +120,22 @@ private:
|
||||
/// prepare() does Impl-specific preparation before handling each row.
|
||||
impl.prepare(Name::name, block, arguments, result_pos);
|
||||
|
||||
bool json_parsed_ok = false;
|
||||
if (col_json_const)
|
||||
{
|
||||
StringRef json{reinterpret_cast<const char *>(&chars[0]), offsets[0] - 1};
|
||||
json_parsed_ok = parser.parse(json);
|
||||
}
|
||||
|
||||
for (const auto i : ext::range(0, input_rows_count))
|
||||
{
|
||||
StringRef json{reinterpret_cast<const char *>(&chars[offsets[i - 1]]), offsets[i] - offsets[i - 1] - 1};
|
||||
bool ok = parser.parse(json);
|
||||
if (!col_json_const)
|
||||
{
|
||||
StringRef json{reinterpret_cast<const char *>(&chars[offsets[i - 1]]), offsets[i] - offsets[i - 1] - 1};
|
||||
json_parsed_ok = parser.parse(json);
|
||||
}
|
||||
|
||||
bool ok = json_parsed_ok;
|
||||
if (ok)
|
||||
{
|
||||
auto it = parser.getRoot();
|
||||
|
@ -64,3 +64,11 @@ Friday
|
||||
{}
|
||||
"\\n\\u0000"
|
||||
"☺"
|
||||
--const/non-const mixed--
|
||||
a
|
||||
b
|
||||
c
|
||||
d
|
||||
e
|
||||
u
|
||||
v
|
||||
|
@ -72,5 +72,9 @@ SELECT JSONExtractRaw('{"a": "hello", "b": [-100, 200.0, 300], "c":{"d":[121,144
|
||||
SELECT JSONExtractRaw('{"a": "hello", "b": [-100, 200.0, 300], "c":{"d":[121,144]}}', 'c', 'd', 3);
|
||||
SELECT JSONExtractRaw('{"passed": true}');
|
||||
SELECT JSONExtractRaw('{}');
|
||||
select JSONExtractRaw('{"abc":"\\n\\u0000"}', 'abc');
|
||||
select JSONExtractRaw('{"abc":"\\u263a"}', 'abc');
|
||||
SELECT JSONExtractRaw('{"abc":"\\n\\u0000"}', 'abc');
|
||||
SELECT JSONExtractRaw('{"abc":"\\u263a"}', 'abc');
|
||||
|
||||
SELECT '--const/non-const mixed--';
|
||||
SELECT JSONExtractString('["a", "b", "c", "d", "e"]', idx) FROM (SELECT arrayJoin([1,2,3,4,5]) AS idx);
|
||||
SELECT JSONExtractString(json, 's') FROM (SELECT arrayJoin(['{"s":"u"}', '{"s":"v"}']) AS json);
|
||||
|
Loading…
Reference in New Issue
Block a user