mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 15:12:02 +00:00
json extract string or raw
This commit is contained in:
parent
2b62a09aa3
commit
0adad2425a
@ -600,6 +600,8 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
template <typename JSONParser>
|
||||
class JSONExtractRawImpl;
|
||||
|
||||
/// Nodes of the extract tree. We need the extract tree to extract from JSON complex values containing array, tuples or nullables.
|
||||
template <typename JSONParser>
|
||||
@ -630,7 +632,10 @@ struct JSONExtractTree
|
||||
public:
|
||||
bool insertResultToColumn(IColumn & dest, const Element & element) override
|
||||
{
|
||||
return JSONExtractStringImpl<JSONParser>::insertResultToColumn(dest, element, {});
|
||||
if (element.isString())
|
||||
return JSONExtractStringImpl<JSONParser>::insertResultToColumn(dest, element, {});
|
||||
else
|
||||
return JSONExtractRawImpl<JSONParser>::insertResultToColumn(dest, element, {});
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -58,7 +58,7 @@ Friday
|
||||
(3,5)
|
||||
(3,0)
|
||||
--JSONExtractKeysAndValues--
|
||||
[('a','hello')]
|
||||
[('a','hello'),('b','[-100,200,300]')]
|
||||
[('b',[-100,200,300])]
|
||||
[('a','hello'),('b','world')]
|
||||
[('a',5),('b',7),('c',11)]
|
||||
@ -160,7 +160,7 @@ Friday
|
||||
(3,5)
|
||||
(3,0)
|
||||
--JSONExtractKeysAndValues--
|
||||
[('a','hello')]
|
||||
[('a','hello'),('b','[-100,200,300]')]
|
||||
[('b',[-100,200,300])]
|
||||
[('a','hello'),('b','world')]
|
||||
[('a',5),('b',7),('c',11)]
|
||||
|
@ -0,0 +1 @@
|
||||
('123','456','[7,8,9]')
|
@ -0,0 +1 @@
|
||||
select JSONExtract('{"a": "123", "b": 456, "c": [7, 8, 9]}', 'Tuple(a String, b String, c String)');
|
Loading…
Reference in New Issue
Block a user