Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SELECT: Update EBNF for partitioning #17985

Merged
merged 6 commits into from
Aug 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 31 additions & 2 deletions sql-statements/sql-statement-select.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,27 @@ SelectStmtOpts ::=
SelectStmtStraightJoin

Copy link
Contributor

@mjonss mjonss Jul 2, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please report an issue with:

SelectStmtBasic ::=
    "SELECT" SelectStmtOpts Field ("," Field)* ( "HAVING" Expression)?

since SELECT * HAVING 1 does not parse.

Also in parser.y, SelectStmtBasic is the first part of SelectStmtFromTable...
But I assume this can all be addressed in a separate issue.

Most likely SelectStmtBasic should not have HavingClause, even in parser.y?

TableRefsClause ::=
TableRef AsOfClause? ( ',' TableRef AsOfClause? )*
TableRef ( ',' TableRef )*

TableRef ::=
TableFactor
| JoinTable

TableFactor ::=
TableName ( "PARTITION" "(" Identifier ("," Identifier)* ")" )? ("AS" TableAlias)? AsOfClause? TableSample?

JoinTable ::=
TableRef
(
("INNER" | "CROSS")? "JOIN" TableRef JoinClause?
| "STRAIGHT_JOIN" TableRef "ON" Expression
| ("LEFT" | "RIGHT") "OUTER"? "JOIN" TableRef JoinClause
| "NATURAL" ("LEFT" | "RIGHT") "OUTER"? "JOIN" TableFactor
)

JoinClause ::=
("ON" Expression
| "USING" "(" ColumnNameList ")" )

AsOfClause ::=
'AS' 'OF' 'TIMESTAMP' Expression
Expand All @@ -47,10 +67,19 @@ SelectLockOpt ::=
TableList ::=
TableName ( ',' TableName )*

WhereClause ::=
"WHERE" Expression
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should the following 3 Expression also include both names/aliases from fields and placement ids (column number)?


GroupByClause ::=
"GROUP" "BY" Expression

OrderBy ::=
"ORDER" "BY" Expression

WindowClause ::=
"WINDOW" WindowDefinition ("," WindowDefinition)*

TableSampleOpt ::=
TableSample ::=
'TABLESAMPLE' 'REGIONS' '(' ')'
```

Expand Down
Loading