mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-11 17:02:25 +00:00
Fix
This commit is contained in:
parent
4c675f0151
commit
01684ad05a
@ -17,22 +17,17 @@ namespace DB
|
|||||||
bool ParserJSONPathMemberAccess::parseImpl(Pos & pos, ASTPtr & node, Expected & expected)
|
bool ParserJSONPathMemberAccess::parseImpl(Pos & pos, ASTPtr & node, Expected & expected)
|
||||||
{
|
{
|
||||||
if (pos->type != TokenType::Dot)
|
if (pos->type != TokenType::Dot)
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
++pos;
|
++pos;
|
||||||
|
|
||||||
if (pos->type != TokenType::BareWord)
|
if (pos->type != TokenType::BareWord && pos->type !=TokenType::QuotedIdentifier)
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
|
|
||||||
ParserIdentifier name_p;
|
ParserIdentifier name_p;
|
||||||
ASTPtr member_name;
|
ASTPtr member_name;
|
||||||
if (!name_p.parse(pos, member_name, expected))
|
if (!name_p.parse(pos, member_name, expected))
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
|
|
||||||
auto member_access = std::make_shared<ASTJSONPathMemberAccess>();
|
auto member_access = std::make_shared<ASTJSONPathMemberAccess>();
|
||||||
node = member_access;
|
node = member_access;
|
||||||
|
@ -9,6 +9,7 @@ null
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
"bar"
|
||||||
--JSON_QUERY--
|
--JSON_QUERY--
|
||||||
[{"hello":1}]
|
[{"hello":1}]
|
||||||
[1]
|
[1]
|
||||||
|
@ -11,6 +11,7 @@ SELECT JSON_VALUE('{"hello":["world","world2"]}', '$.hello');
|
|||||||
SELECT JSON_VALUE('{"hello":{"world":"!"}}', '$.hello');
|
SELECT JSON_VALUE('{"hello":{"world":"!"}}', '$.hello');
|
||||||
SELECT JSON_VALUE('{hello:world}', '$.hello'); -- invalid json => default value (empty string)
|
SELECT JSON_VALUE('{hello:world}', '$.hello'); -- invalid json => default value (empty string)
|
||||||
SELECT JSON_VALUE('', '$.hello');
|
SELECT JSON_VALUE('', '$.hello');
|
||||||
|
SELECT JSON_VALUE('{"foo foo":"bar"}', '$."foo foo"');
|
||||||
|
|
||||||
SELECT '--JSON_QUERY--';
|
SELECT '--JSON_QUERY--';
|
||||||
SELECT JSON_QUERY('{"hello":1}', '$');
|
SELECT JSON_QUERY('{"hello":1}', '$');
|
||||||
|
Loading…
Reference in New Issue
Block a user