snuyanzin commented on code in PR #29828:
URL: https://github.com/apache/flink/pull/29828#discussion_r4524416045
##########
flink-table/flink-table-code-splitter/src/main/java/org/apache/flink/table/codesplit/FunctionSplitter.java:
##########
@@ -225,44 +227,70 @@ public Void
visitFormalParameter(JavaParser.FormalParameterContext ctx) {
blockContext.start, String.format("\n%s = false;",
hasReturnedVarName));
}
- for (String methodBody : mergedCodeBlocks) {
- long counter = CodeSplitUtil.getCounter().getAndIncrement();
-
- // void f_splitXX(int x, String y)
- String splitMethodDef =
- returnType
- + " "
- + functionName
- + "_split"
- + counter
- + parameters
- + methodQualifier;
-
- String newSplitMethod = splitMethodDef + " {\n" + methodBody +
"\n}\n";
-
- String newSplitMethodCall =
- functionName
- + "_split"
- + counter
- + "("
- + String.join(", ", declarations)
- + ");\n";
- if (hasReturnedVarName != null &&
newSplitMethod.contains(hasReturnedVarName)) {
- newSplitMethodCall +=
- String.format("if (%s) { return; }\n",
hasReturnedVarName);
+ List<String> blocks = mergedCodeBlocks;
+ Set<String> singleCalls = new HashSet<>();
+ while (true) {
+ newSplitMethodCalls.clear();
+ for (String methodBody : blocks) {
+ if (singleCalls.contains(methodBody.trim())) {
Review Comment:
dropped trim from here
added replacement of empty lines with one line in a separate commit
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]