-
Notifications
You must be signed in to change notification settings - Fork 104
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
Support UDF in plan generator #3040
base: main
Are you sure you want to change the base?
Changes from all commits
3a5a44b
53416bf
3f88bb4
773e0dd
fa472d7
4c32432
ccd8e8d
403a4a2
cada59a
3b02019
138a7fc
f8b3658
b4edc0a
c42c0ce
a570479
f4e5cac
c10ec5b
0d9cc50
057fee0
37c8641
a52d15a
74c24fb
2f33668
01c4d01
8c70b2a
5d59fa2
7e84176
0d54f1e
543a79c
8fd8208
f5b3314
9956a9f
5476bb4
f9fd6a9
651816c
2c886c8
38a8004
4f7a23f
25eb6cf
6ebd19b
f8088f5
157ab0c
0daa4ce
9a325bf
bffaca4
b3589d2
46eaaf1
523859e
18312ed
0a70d6e
d058c09
67fad06
3adcce3
74602e7
fa28a85
b0e5b37
91322a2
eee22fc
41112ed
df4235e
c343ed3
6aaae1d
4f2b546
e11b315
29b9cb2
52b3ba4
1cc89a6
91e6117
262f03b
4015220
e8c4dfc
8076737
cea7e31
a71c70b
ed5e452
7f030c9
e3bbc51
f5256d9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -88,7 +88,7 @@ utilityStatement | |
|
||
templateClause | ||
: | ||
CREATE ( structDefinition | tableDefinition | enumDefinition | indexDefinition ) | ||
CREATE ( structDefinition | tableDefinition | enumDefinition | indexDefinition | functionDefinition) | ||
; | ||
|
||
createStatement | ||
|
@@ -154,6 +154,10 @@ indexDefinition | |
: (UNIQUE)? INDEX indexName=uid AS queryTerm indexAttributes? | ||
; | ||
|
||
functionDefinition | ||
: FUNCTION functionName=uid LEFT_ROUND_BRACKET paramName=uid inputTypeName=columnType RIGHT_ROUND_BRACKET RETURNS columnType AS fullId | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we make this clearer as to what this function definition actually does? How about explicitly saying |
||
; | ||
|
||
indexAttributes | ||
: WITH ATTRIBUTES indexAttribute (COMMA indexAttribute)* | ||
; | ||
|
@@ -560,6 +564,11 @@ uid | |
| DOUBLE_QUOTE_ID | ||
; | ||
|
||
userDefinedFunctionName | ||
: ID | ||
| DOUBLE_QUOTE_ID | ||
; | ||
|
||
// done | ||
simpleId | ||
: ID | ||
|
@@ -789,6 +798,7 @@ functionCall | |
: aggregateWindowedFunction #aggregateFunctionCall // done (supported) | ||
| specificFunction #specificFunctionCall // | ||
| scalarFunctionName '(' functionArgs? ')' #scalarFunctionCall // done (unsupported) | ||
| userDefinedFunctionName '(' functionArgs? ')' #userDefinedFunctionCall | ||
; | ||
|
||
specificFunction | ||
|
@@ -899,7 +909,7 @@ levelInWeightListElement | |
; | ||
|
||
aggregateWindowedFunction | ||
: functionName=(AVG | MAX | MIN | SUM | MAX_EVER | MIN_EVER ) | ||
: functionName=(AVG | MAX | MIN | SUM | MAX_EVER | MIN_EVER) | ||
'(' aggregator=(ALL | DISTINCT)? functionArg ')' overClause? | ||
| functionName=BITMAP_CONSTRUCT_AGG '(' functionArg ')' | ||
| functionName=COUNT '(' (starArg='*' | aggregator=ALL? functionArg | aggregator=DISTINCT functionArgs) ')' overClause? | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -128,6 +128,13 @@ public boolean prefixedWith(@Nonnull Identifier identifier) { | |
return true; | ||
} | ||
|
||
@Nonnull | ||
public List<String> removePrefix(@Nonnull Identifier prefix) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What is this used for? |
||
// assume the identifier has the prefix, should call prefixedWith(prefix) to check before calling this method | ||
final var fullName = fullyQualifiedName(); | ||
return fullName.subList(prefix.fullyQualifiedName().size(), fullName.size()); | ||
} | ||
|
||
public boolean qualifiedWith(@Nonnull Identifier identifier) { | ||
final var identifierFullName = identifier.fullyQualifiedName(); | ||
final var fullName = fullyQualifiedName(); | ||
|
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.
Doesn't this only declare exactly one parameter? We certainly want to support more than one parameter. Maybe I am misreading this.