jduo commented on code in PR #3901:
URL: https://github.com/apache/calcite/pull/3901#discussion_r1769206136


##########
linq4j/src/main/java/org/apache/calcite/linq4j/tree/MethodDeclaration.java:
##########
@@ -59,20 +61,38 @@ public MethodDeclaration(int modifier, String name, Type 
resultType,
   }
 
   @Override public void accept(ExpressionWriter writer) {
+    final ExpressionWriter tempWriter = writer.duplicateState();
     String modifiers = Modifier.toString(modifier);
-    writer.append(modifiers);
+    tempWriter.append(modifiers);
     if (!modifiers.isEmpty()) {
-      writer.append(' ');
+      tempWriter.append(' ');
     }
     //noinspection unchecked
-    writer
+    tempWriter
         .append(resultType)
         .append(' ')
         .append(name)
         .list("(", ", ", ")",
             () -> (Iterator) 
parameters.stream().map(ParameterExpression::declString).iterator())
         .append(' ')
         .append(body);
+
+    // From Flink TableConfigOptions.MAX_LENGTH_GENERATED_CODE
+    // Note that Flink uses 4000 rather than 64KB explicitly:
+    // "Specifies a threshold where generated code will be split into 
sub-function calls.
+    //  Java has a maximum method length of 64 KB. This setting allows for 
finer granularity if
+    //  necessary.
+    //  Default value is 4000 instead of 64KB as by default JIT refuses to 
work on methods with
+    //  more than 8K byte code."
+    final int flinkDefaultMaxGeneratedCodeLength = 4000;
+
+    // From Flink TableConfigOptions.MAX_MEMBERS_GENERATED_CODE

Review Comment:
   I've removed references to Flink here.



-- 
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]

Reply via email to