This commit is contained in:
kssenii 2021-11-02 16:53:21 +03:00
parent 4c675f0151
commit 01684ad05a
3 changed files with 4 additions and 7 deletions

View File

@ -17,22 +17,17 @@ namespace DB
bool ParserJSONPathMemberAccess::parseImpl(Pos & pos, ASTPtr & node, Expected & expected)
{
if (pos->type != TokenType::Dot)
{
return false;
}
++pos;
if (pos->type != TokenType::BareWord)
{
if (pos->type != TokenType::BareWord && pos->type !=TokenType::QuotedIdentifier)
return false;
}
ParserIdentifier name_p;
ASTPtr member_name;
if (!name_p.parse(pos, member_name, expected))
{
return false;
}
auto member_access = std::make_shared<ASTJSONPathMemberAccess>();
node = member_access;

View File

@ -9,6 +9,7 @@ null
"bar"
--JSON_QUERY--
[{"hello":1}]
[1]

View File

@ -11,6 +11,7 @@ SELECT JSON_VALUE('{"hello":["world","world2"]}', '$.hello');
SELECT JSON_VALUE('{"hello":{"world":"!"}}', '$.hello');
SELECT JSON_VALUE('{hello:world}', '$.hello'); -- invalid json => default value (empty string)
SELECT JSON_VALUE('', '$.hello');
SELECT JSON_VALUE('{"foo foo":"bar"}', '$."foo foo"');
SELECT '--JSON_QUERY--';
SELECT JSON_QUERY('{"hello":1}', '$');