-
Notifications
You must be signed in to change notification settings - Fork 2.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
CALCITE-6465: Rework code generator to use Flink code splitter #3901
base: main
Are you sure you want to change the base?
Changes from all commits
6ac2d2e
c63821e
5556360
d3cf335
739c747
e9e20e1
dc783a9
b7553e4
f63b665
4216e80
2077d1e
fd2de3d
8f04243
dd5b995
8f62b88
1766b35
cd33092
dc1c66d
2ce8cac
6d545db
6200d82
39e14a4
d969ee4
232eb8e
2887c0d
fdd0d18
80c8587
4a258d8
c28f962
4f95aa0
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 |
---|---|---|
|
@@ -111,7 +111,9 @@ public static Bindable toBindable(Map<String, Object> parameters, | |
parameters); | ||
|
||
final ClassDeclaration expr = relImplementor.implementRoot(rel, prefer); | ||
String s = Expressions.toString(expr.memberDeclarations, "\n", false); | ||
String s = | ||
Expressions.toString(expr.memberDeclarations, "\n", false, | ||
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. It seems that code split is not effective here. This is because the code splitting logic in this pr is implemented in ClassDeclaration, and the expr.memberDeclarations here is usually MethodDeclaration. 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. @asdfgh19 , thanks for your comments. Would you be able to add tests for your scenarios to the PR? For this one, it seems like we a can pass expr to Expressions.toString(), but I'm not sure what effect that has on the calls that depend on s ( |
||
CalciteSystemProperty.MAX_METHOD_LENGTH_IN_CHARS_BEFORE_SPLITTING.value()); | ||
|
||
if (CalciteSystemProperty.DEBUG.value()) { | ||
Util.debugCode(System.out, s); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -186,7 +186,9 @@ static Scalar.Producer baz(ParameterExpression context_, | |
final ClassDeclaration classDeclaration = | ||
Expressions.classDecl(Modifier.PUBLIC, "Buzz", null, | ||
ImmutableList.of(Scalar.Producer.class), declarations); | ||
String s = Expressions.toString(declarations, "\n", false); | ||
String s = | ||
Expressions.toString(declarations, "\n", false, | ||
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. The declarations here usually do not look like ClassDeclarations either. |
||
CalciteSystemProperty.MAX_METHOD_LENGTH_IN_CHARS_BEFORE_SPLITTING.value()); | ||
if (CalciteSystemProperty.DEBUG.value()) { | ||
Util.debugCode(System.out, s); | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -100,7 +100,9 @@ private static String compile(RexBuilder rexBuilder, List<RexNode> constExps, | |
Expressions.methodDecl(Modifier.PUBLIC, Object[].class, | ||
BuiltInMethod.FUNCTION1_APPLY.method.getName(), | ||
ImmutableList.of(root0_), blockBuilder.toBlock()); | ||
String code = Expressions.toString(methodDecl); | ||
String code = | ||
Expressions.toString(methodDecl, | ||
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. The methodDecl here is a MethodDeclaration, not a ClassDeclaration, so it seems that the code splitting logic implemented in the ClassDeclaration does not work here. 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. It seems that this code relates to RexExecutable. The method body is generated here and written to String, then gets attached as the body of a class in RexExecutable that's run directly in Janino's IClassBodyEvaluator. This will be quite complicated to rework. |
||
CalciteSystemProperty.MAX_METHOD_LENGTH_IN_CHARS_BEFORE_SPLITTING.value()); | ||
if (CalciteSystemProperty.DEBUG.value()) { | ||
Util.debugCode(System.out, code); | ||
} | ||
|
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.
Add a note above this list of declarations that we import flink-table-code-splitter but we must not import core flink modules.
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.
Done.