Skip to content

Function call using SelectElements for parameters #28

@cam-m

Description

@cam-m

I'm not sure the SimpleSelectStatement.select and PrimaryExpression.FunctionCall rules are correct.

I'm assuming FunctionCall is intended to parse system function calls (E.g. ABS() or DATEADD(), etc)

Problems:

  1. It currently uses the SelectElements rule for its params property;
{infer FunctionCall} function=GlobalReference '(' params=SelectElements? ')' 
      overClause=OverClause?

SelectElements:
    ('ALL'|distinct?='DISTINCT')? elements+=SelectElement (',' elements+=SelectElement)*
;
SelectElement infers SelectElement:
    {infer AllStar} '*'
    | {infer AllTable} variableName=[TableVariableSource:Identifier] '.' '*'
    | {infer ExpressionQuery} expr=Expression ('AS'? name=Identifier)?
;
  1. FunctionCall also directly defines the OVER statement, which should probably only be in SimpleSelectStatement in a window function expression

Happy to propose a fix if I've understood this correctly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions