add transition from reading key to reading quoted key when double quotes are found

This commit is contained in:
Arthur Passos 2023-11-07 13:33:02 -03:00
parent a011990fd7
commit e4400ec24c
3 changed files with 29 additions and 0 deletions

View File

@ -106,6 +106,11 @@ public:
{
return {next_pos, State::WAITING_KEY};
}
else if (isQuotingCharacter(*p))
{
// +1 to skip quoting character
return {next_pos, State::READING_QUOTED_KEY};
}
pos = next_pos;
}

View File

@ -345,6 +345,18 @@ WITH
SELECT
x;
{'argument1':'1','argument2':'2','char':'=','char2':'=','formula':'1+2=3','result':'3','string':'foo=bar'}
-- https://github.com/ClickHouse/ClickHouse/issues/56357
WITH
extractKeyValuePairs('{"a":"1", "b":"2"}') as s_map,
CAST(
arrayMap(
(x) -> (x, s_map[x]), arraySort(mapKeys(s_map))
),
'Map(String,String)'
) AS x
SELECT
x;
{'a':'1','b':'2'}
-- check str_to_map alias (it is case-insensitive)
WITH
sTr_tO_mAp('name:neymar, age:31 team:psg,nationality:brazil') AS s_map,

View File

@ -481,6 +481,18 @@ WITH
SELECT
x;
-- https://github.com/ClickHouse/ClickHouse/issues/56357
WITH
extractKeyValuePairs('{"a":"1", "b":"2"}') as s_map,
CAST(
arrayMap(
(x) -> (x, s_map[x]), arraySort(mapKeys(s_map))
),
'Map(String,String)'
) AS x
SELECT
x;
-- check str_to_map alias (it is case-insensitive)
WITH
sTr_tO_mAp('name:neymar, age:31 team:psg,nationality:brazil') AS s_map,