-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
Add syntax support for CREATE FUNCTION #13481
Conversation
This PR is ready for review. |
At least add another commit to hook this up to call |
presto-parser/src/test/java/com/facebook/presto/sql/parser/TestSqlParser.java
Show resolved
Hide resolved
presto-parser/src/main/antlr4/com/facebook/presto/sql/parser/SqlBase.g4
Outdated
Show resolved
Hide resolved
9a7c177
to
fce596f
Compare
@rongrong Per offline discussion, removed |
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.
Mostly look good except I think that function body should include RETURN
. Maybe good to have another pair of eyes since this is a syntax change. @arhimondr @kaikalur
presto-parser/src/main/antlr4/com/facebook/presto/sql/parser/SqlBase.g4
Outdated
Show resolved
Hide resolved
presto-parser/src/main/java/com/facebook/presto/sql/tree/ParameterDeclaration.java
Outdated
Show resolved
Hide resolved
2996871
to
cbbfa56
Compare
comments addressed |
@@ -0,0 +1,124 @@ | |||
/* |
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.
A general comment, not specific to this - for things like this, it may be simpler to just add these as attributes to the CreateFunction node to reduce code bloat and make it easy to work with the visitor.
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.
This will be a reusable unit in ALTER FUNCTION
so it makes sense to have it separated. Visitor won't touch this class since it is not a subclass of Node
, or a child of Create Function
.
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.
LGTM % questions / nits
@@ -472,21 +507,21 @@ nonReserved | |||
// IMPORTANT: this rule must only contain tokens. Nested rules are not supported. See SqlParser.exitNonReserved | |||
: ADD | ADMIN | ALL | ANALYZE | ANY | ARRAY | ASC | AT | |||
| BERNOULLI | |||
| CALL | CASCADE | CATALOGS | COLUMN | COLUMNS | COMMENT | COMMIT | COMMITTED | CURRENT | CURRENT_ROLE | |||
| DATA | DATE | DAY | DESC | DISTRIBUTED | |||
| CALL | CALLED | CASCADE | CATALOGS | COLUMN | COLUMNS | COMMENT | COMMIT | COMMITTED | CURRENT | CURRENT_ROLE |
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.
question: none of the newly introduced keywords are reserved? Did we check the spec?
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.
Fixed: They are in fact all reserved words.
Also updated reserved.rst
to pass tests.
presto-parser/src/main/java/com/facebook/presto/sql/SqlFormatter.java
Outdated
Show resolved
Hide resolved
presto-parser/src/main/java/com/facebook/presto/sql/parser/AstBuilder.java
Outdated
Show resolved
Hide resolved
presto-parser/src/main/java/com/facebook/presto/sql/tree/RoutineCharacteristics.java
Show resolved
Hide resolved
637b878
to
ad4fd4b
Compare
ed0f080
to
2099686
Compare
@caithagoras There's still a test failure (error message change) |
Introduce CREATE FUNCTION syntax as according to #13254