-
Notifications
You must be signed in to change notification settings - Fork 62
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
Adds parsing and modeling of CTEs #1736
Conversation
Adds parsing and ast modeling for WITH clause Fixes the expression tree to exclude SELECTs Adds a dedicated subquery node to allow for query expressions
b9575e4
to
af0995b
Compare
Updates the AST Rewriter for the WITH clause Adds test for the unsupported feature of planning a with clause
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it worth modeling RECURSIVE
now? If nothing else, we could emit an error for now, but we wouldn't need to touch the parser/AST again.
private final List<WithListElement> elements; | ||
|
||
/** | ||
* TODO |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Curious when we will 'TODO'? as part of the rest of the CTE work?
*/ | ||
@Builder(builderClassName = "Builder") | ||
@EqualsAndHashCode(callSuper = false) | ||
public final class With extends AstNode { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should there be a helper constructor for With
in org.partiql.ast.Ast
?
Adds support for parsing RECURSIVE CTEs Adds modeling of RECURSIVE in AST Updates Javadoc TODOs Adds Ast#with and Ast#withListElement Adds a TODO for search/cycle
Updated PR to address comments @jpschorr |
Description
exprBagOp
andexprSelect
were at the top of theexpr
grammar. This isn't right.expr
andselectStatement
are distinct variants ofdql
.selectStatement
is now almost identical to the SQL:1999 and SQL:2023 EBNF. I've noted all of the rules and their origin (and where they deviate). Notably, asimpleTable
, in PartiQL, can be an arbitrary expression -- which is not allowed in SQL. This allows for the UNION (and other bag ops) of arbitrary expressions. Note that the visitor prohibits non-bag-ops and non-select expressions coupled with the with clause, order by clause, limit clause, and offset clause.subquery
(which is a parenthesized query expression) and the allowance for the direct use of SELECT in a function call (to handle the specification'sCOLL_AGG(SELECT ...)
without the use of additional parentheses).API Changes and Release
There are NO API breaking changes. This feature addition will go in the
v1.1.0
release.This PR adds
With
andWithListElement
. It also adds JoinTypes that allow for LEFT CROSS JOIN, RIGHT CROSS JOIN, FULL CROSS JOIN, and INNER CROSS JOIN. The LEFT CROSS JOIN was already present in the previous implementation. There are parsing conformance tests that also use the remaining.Upcoming Changes
Before the release of
v1.1.0
, a follow-up PR will add for planning and evaluation of the WITH clause.License Information
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.