'ClickHouse JSONEachRow accepting escape of double quotes?
I have to store JSON information as String in a Map in ClickHouse, since Map is allowing Array(String) but not an structured object. The problem is on inserting a JSON structure (with double quotes inside) as a String into the field.
CREATE TABLE table_map_2 (a Map(String, Array(String))) ENGINE=Memory;
Here, this works in the command line:
insert into table_map_2 VALUES ({'{"group":"sem"}':['{"date":"2022-02-12"}']})
However my format is coming (from Kafka) via JSONEachRow, where the serialization does not use single quotes but double quotes instead (escaping the double quotes but enclosing in unescaped double quotes):
insert into table_map_2 VALUES ({"{\"group\":\"sem\"}":["{\"date\":\"2022-02-12\"}"]})
Code: 62. DB::Exception: Cannot parse expression of type Map(String, Array(String)) here: {"{\"group\":\"sem\"}":["{\"date\":\"2022-02-12\"}"]}): While executing ValuesBlockInputFormat: data for INSERT was parsed from query. (SYNTAX_ERROR)
Will this format with double quotes be respected if it is sent via JSONEachRow as Kafka entries:
{"{\"group\":\"sem\"}":["{\"date\":\"2022-02-12\"}"]}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|