mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 23:21:59 +00:00
Merge pull request #31003 from kssenii/sql-json-fix
Allow spaces in JSONPath.
This commit is contained in:
commit
2a617e6a5a
@ -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;
|
||||
|
@ -9,6 +9,7 @@ null
|
||||
|
||||
|
||||
|
||||
"bar"
|
||||
--JSON_QUERY--
|
||||
[{"hello":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'); -- 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}', '$');
|
||||
|
Loading…
Reference in New Issue
Block a user