-
Notifications
You must be signed in to change notification settings - Fork 13.8k
[FLINK-35856] [table] Upgrade Calcite version to 1.37.0 #26895
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
Open
michalstutzmann
wants to merge
10
commits into
apache:master
Choose a base branch
from
swisscom-bigdata:flink-35856
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+2,078
−1,277
Open
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
57c2fec
Upgrade Calcite version to 1.37.0
ff045c1
Format
a4c4fb7
Format
a443034
Update versions for licence checks
e25fe85
Correct comment about Janino version
3c90fe0
Try Janino 3.1.11
0cd5508
Add Janino to NOTICE file for licence checks
5ce11ca
Fix Janino licence checks
02bc92f
Try Janino 3.1.12
64ead2b
Add Janino's compiler factory service to META-INF/services
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -73,6 +73,7 @@ import org.apache.calcite.sql.SqlJsonQueryWrapperBehavior; | |
import org.apache.calcite.sql.SqlJsonValueEmptyOrErrorBehavior; | ||
import org.apache.calcite.sql.SqlJsonValueReturning; | ||
import org.apache.calcite.sql.SqlKind; | ||
import org.apache.calcite.sql.SqlLambda; | ||
import org.apache.calcite.sql.SqlLiteral; | ||
import org.apache.calcite.sql.SqlMatchRecognize; | ||
import org.apache.calcite.sql.SqlMerge; | ||
|
@@ -1033,6 +1034,9 @@ void AddArg0(List<SqlNode> list, ExprContext exprContext) : | |
) | ||
( | ||
e = Default() | ||
| | ||
LOOKAHEAD((SimpleIdentifierOrList() | <LPAREN> <RPAREN>) <LAMBDA>) | ||
e = LambdaExpression() | ||
| | ||
LOOKAHEAD(3) | ||
e = TableParam() | ||
|
@@ -1060,6 +1064,9 @@ void AddArg(List<SqlNode> list, ExprContext exprContext) : | |
) | ||
( | ||
e = Default() | ||
| | ||
LOOKAHEAD((SimpleIdentifierOrList() | <LPAREN> <RPAREN>) <LAMBDA>) | ||
e = LambdaExpression() | ||
| | ||
e = Expression(exprContext) | ||
| | ||
|
@@ -3951,6 +3958,43 @@ SqlNode Expression3(ExprContext exprContext) : | |
} | ||
} | ||
|
||
/** | ||
* Parses a lambda expression. | ||
*/ | ||
SqlNode LambdaExpression() : | ||
{ | ||
final SqlNodeList parameters; | ||
final SqlNode expression; | ||
final Span s; | ||
} | ||
{ | ||
parameters = SimpleIdentifierOrListOrEmpty() | ||
<LAMBDA> { s = span(); } | ||
expression = Expression(ExprContext.ACCEPT_NON_QUERY) | ||
{ | ||
return new SqlLambda(s.end(this), parameters, expression); | ||
} | ||
} | ||
|
||
/** | ||
* List of simple identifiers in parentheses or empty parentheses or one simple identifier. | ||
* <ul>Examples: | ||
* <li>{@code ()} | ||
* <li>{@code DEPTNO} | ||
* <li>{@code (EMPNO, DEPTNO)} | ||
* </ul> | ||
*/ | ||
SqlNodeList SimpleIdentifierOrListOrEmpty() : | ||
{ | ||
SqlNodeList list; | ||
} | ||
{ | ||
LOOKAHEAD(2) | ||
<LPAREN> <RPAREN> { return SqlNodeList.EMPTY; } | ||
| | ||
list = SimpleIdentifierOrList() { return list; } | ||
} | ||
|
||
SqlOperator periodOperator() : | ||
{ | ||
} | ||
|
@@ -4742,6 +4786,7 @@ SqlLiteral DateTimeLiteral() : | |
{ | ||
final String p; | ||
final Span s; | ||
boolean local = false; | ||
} | ||
{ | ||
<LBRACE_D> <QUOTED_STRING> { | ||
|
@@ -4773,6 +4818,7 @@ SqlLiteral DateTimeLiteral() : | |
return SqlLiteral.createUnknown("DATETIME", p, s.end(this)); | ||
} | ||
| | ||
LOOKAHEAD(2) | ||
<TIME> { s = span(); } p = SimpleStringLiteral() { | ||
return SqlLiteral.createUnknown("TIME", p, s.end(this)); | ||
} | ||
|
@@ -4782,8 +4828,14 @@ SqlLiteral DateTimeLiteral() : | |
return SqlLiteral.createUnknown("TIMESTAMP", p, s.end(this)); | ||
} | ||
| | ||
<TIMESTAMP> { s = span(); } <WITH> <LOCAL> <TIME> <ZONE> p = SimpleStringLiteral() { | ||
return SqlLiteral.createUnknown("TIMESTAMP WITH LOCAL TIME ZONE", p, s.end(this)); | ||
LOOKAHEAD(2) | ||
<TIME> { s = span(); } <WITH> ( <LOCAL> { local = true; } )? <TIME> <ZONE> p = SimpleStringLiteral() { | ||
return SqlLiteral.createUnknown("TIME WITH " + (local ? "LOCAL " : "") + "TIME ZONE", p, s.end(this)); | ||
} | ||
| | ||
LOOKAHEAD(2) | ||
<TIMESTAMP> { s = span(); } <WITH> ( <LOCAL> { local = true; } )? <TIME> <ZONE> p = SimpleStringLiteral() { | ||
return SqlLiteral.createUnknown("TIMESTAMP WITH " + (local ? "LOCAL " : "") + "TIME ZONE", p, s.end(this)); | ||
Comment on lines
+4832
to
+4838
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. is it now also supported for Flink? |
||
} | ||
} | ||
|
||
|
@@ -6070,7 +6122,6 @@ SqlTypeNameSpec DateTimeTypeName() : | |
{ | ||
int precision = -1; | ||
SqlTypeName typeName; | ||
boolean withLocalTimeZone = false; | ||
final Span s; | ||
} | ||
{ | ||
|
@@ -6082,25 +6133,15 @@ SqlTypeNameSpec DateTimeTypeName() : | |
LOOKAHEAD(2) | ||
<TIME> { s = span(); } | ||
precision = PrecisionOpt() | ||
withLocalTimeZone = TimeZoneOpt() | ||
typeName = TimeZoneOpt(true) | ||
{ | ||
if (withLocalTimeZone) { | ||
typeName = SqlTypeName.TIME_WITH_LOCAL_TIME_ZONE; | ||
} else { | ||
typeName = SqlTypeName.TIME; | ||
} | ||
return new SqlBasicTypeNameSpec(typeName, precision, s.end(this)); | ||
} | ||
| | ||
<TIMESTAMP> { s = span(); } | ||
precision = PrecisionOpt() | ||
withLocalTimeZone = TimeZoneOpt() | ||
typeName = TimeZoneOpt(false) | ||
{ | ||
if (withLocalTimeZone) { | ||
typeName = SqlTypeName.TIMESTAMP_WITH_LOCAL_TIME_ZONE; | ||
} else { | ||
typeName = SqlTypeName.TIMESTAMP; | ||
} | ||
return new SqlBasicTypeNameSpec(typeName, precision, s.end(this)); | ||
} | ||
} | ||
|
@@ -6121,23 +6162,21 @@ int PrecisionOpt() : | |
|
||
/** | ||
* Parse a time zone suffix for DateTime types. According to SQL-2011, | ||
* "with time zone" and "without time zone" belong to standard SQL but we | ||
* only implement the "without time zone". | ||
* | ||
* <p>We also support "with local time zone". | ||
* | ||
* @return true if this is "with local time zone". | ||
* "with time zone" and "without time zone" belong to standard SQL. | ||
* We also support "with local time zone". | ||
*/ | ||
boolean TimeZoneOpt() : | ||
SqlTypeName TimeZoneOpt(boolean timeType) : | ||
{ | ||
boolean local = false; | ||
} | ||
{ | ||
LOOKAHEAD(3) | ||
<WITHOUT> <TIME> <ZONE> { return false; } | ||
<WITHOUT> <TIME> <ZONE> { return timeType ? SqlTypeName.TIME : SqlTypeName.TIMESTAMP; } | ||
| | ||
<WITH> <LOCAL> <TIME> <ZONE> { return true; } | ||
<WITH> ( <LOCAL> { local = true; } )? <TIME> <ZONE> { | ||
return timeType ? (local ? SqlTypeName.TIME_WITH_LOCAL_TIME_ZONE : SqlTypeName.TIME_TZ) | ||
: (local ? SqlTypeName.TIMESTAMP_WITH_LOCAL_TIME_ZONE : SqlTypeName.TIMESTAMP_TZ); } | ||
| | ||
{ return false; } | ||
{ return timeType ? SqlTypeName.TIME : SqlTypeName.TIMESTAMP; } | ||
} | ||
|
||
/** | ||
|
@@ -6178,6 +6217,7 @@ SqlNode BuiltinFunctionCall() : | |
final SqlNode node; | ||
final SqlLiteral style; // mssql convert 'style' operand | ||
final SqlFunction f; | ||
final SqlNode format; | ||
} | ||
{ | ||
//~ FUNCTIONS WITH SPECIAL SYNTAX --------------------------------------- | ||
|
@@ -6194,6 +6234,7 @@ SqlNode BuiltinFunctionCall() : | |
| | ||
<INTERVAL> e = IntervalQualifier() { args.add(e); } | ||
) | ||
[ <FORMAT> format = StringLiteral() { args.add(format); } ] | ||
<RPAREN> { | ||
return f.createCall(s.end(this), args); | ||
} | ||
|
@@ -6733,6 +6774,12 @@ List<SqlNode> JsonNameAndValue() : | |
} | ||
( | ||
<VALUE> | ||
| | ||
<COMMA> { | ||
if (kvMode) { | ||
throw SqlUtil.newContextException(getPos(), RESOURCE.illegalComma()); | ||
} | ||
} | ||
| | ||
<COLON> { | ||
if (kvMode) { | ||
|
@@ -8834,6 +8881,7 @@ void NonReservedKeyWord2of3() : | |
| < NE2: "!=" > | ||
| < PLUS: "+" > | ||
| < MINUS: "-" > | ||
| < LAMBDA: "->" > | ||
| < STAR: "*" > | ||
| < SLASH: "/" > | ||
| < PERCENT_REMAINDER: "%" > | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
can we have a dummy test showing that it fails somewhere on validation rather than in runtime?