Skip to content

[FLINK-35854][table] Upgrade Calcite version to 1.35.0 #26547

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

Draft
wants to merge 12 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
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
6 changes: 3 additions & 3 deletions flink-table/flink-sql-parser/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,12 @@ under the License.
<version>${calcite.version}</version>
<exclusions>
<!--
"mvn dependency:tree" as of Calcite 1.34.0:
"mvn dependency:tree" as of Calcite 1.35.0:

[INFO] +- org.apache.calcite:calcite-core:jar:1.34.0:compile
[INFO] +- org.apache.calcite:calcite-core:jar:1.35.0:compile
[INFO] | +- org.apache.calcite.avatica:avatica-core:jar:1.23.0:compile
[INFO] | +- org.apiguardian:apiguardian-api:jar:1.1.2:compile
[INFO] | +- org.checkerframework:checker-qual:jar:3.12.0:compile
[INFO] | +- org.checkerframework:checker-qual:jar:3.10.0:compile
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this is not related to this commit, however seems at some point the version was downgraded in Flink.
There is no critical changes, so should be ok

[INFO] | \- org.apache.commons:commons-math3:jar:3.6.1:runtime

Dependencies that are not needed for how we use Calcite right now.
Expand Down
11 changes: 8 additions & 3 deletions flink-table/flink-sql-parser/src/main/codegen/data/Parser.tdd
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,6 @@
"RESUME"
"TABLES"
"TIMESTAMP_LTZ"
"TRY_CAST"
Copy link
Contributor

Choose a reason for hiding this comment

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

I am curious why TRY_CAST is removed as a keyword. I had assumed it would still be a keyword but Calcite would now provide the implementation.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

because it was added to keywords on Calcite level, no need to add it one more time

"UNLOAD"
"USE"
"VIEWS"
Expand Down Expand Up @@ -293,6 +292,8 @@
"DATETIME_DIFF"
"DATETIME_INTERVAL_CODE"
"DATETIME_INTERVAL_PRECISION"
"DAYOFWEEK"
Copy link
Contributor

Choose a reason for hiding this comment

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

I am curious why these 2 re in this list and not in nonReservedKeywordsToAdd.

"DAYOFYEAR"
"DAYS"
"DECADE"
"DEFAULTS"
Expand Down Expand Up @@ -578,7 +579,6 @@
"OVERWRITING"
"PARTITIONED"
"PARTITIONS"
"TRY_CAST"
"VIRTUAL"
"ANALYZE"
"COMPUTE"
Expand Down Expand Up @@ -666,7 +666,6 @@
# Return type of method implementation should be "SqlNode".
# Example: DateFunctionCall().
builtinFunctionCallMethods: [
"TryCastFunctionCall()"
"ExplicitModel()"
]

Expand All @@ -688,6 +687,12 @@
"SqlDropExtended"
]

# List of methods for parsing extensions to "TRUNCATE" calls.
# Each must accept arguments "(SqlParserPos pos)".
# Example: "SqlTruncate".
truncateStatementParserMethods: [
]

# Binary operators tokens
binaryOperatorsTokens: [
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3061,34 +3061,6 @@ SqlNode SqlReset() :
}
}


/** Parses a TRY_CAST invocation. */
Copy link
Contributor Author

@snuyanzin snuyanzin May 12, 2025

Choose a reason for hiding this comment

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

Since now TRY_CAST comes with Calcite https://issues.apache.org/jira/browse/CALCITE-4771

SqlNode TryCastFunctionCall() :
{
final Span s;
final SqlOperator operator;
List<SqlNode> args = null;
SqlNode e = null;
}
{
<TRY_CAST> {
s = span();
operator = new SqlUnresolvedTryCastFunction(s.pos());
}
<LPAREN>
e = Expression(ExprContext.ACCEPT_SUB_QUERY) { args = startList(e); }
<AS>
(
e = DataType() { args.add(e); }
|
<INTERVAL> e = IntervalQualifier() { args.add(e); }
)
<RPAREN>
{
return operator.createCall(s.end(this), args);
}
}

/**
* Parses an explicit Model m reference.
*/
Expand Down
Loading