manner commented on code in PR #29384:
URL: https://github.com/apache/flink/pull/29384#discussion_r4192555746


##########
flink-table/flink-table-planner/src/main/java/org/apache/flink/table/planner/codegen/JsonCodeGenUtils.java:
##########
@@ -89,76 +89,30 @@ public static GeneratedExpression generateJsonLength(
      * overload with the {@code isPathDefinite} flag resolved from the path 
literal at plan time via
      * {@link SqlJsonUtils#isPathDefinite(String)}.
      *
-     * @return the parse statement and the call expression
+     * @return an empty statement and the call expression
      */
     private static Tuple2<String, String> generateCallOnParsedInput(
             CodeGeneratorContext ctx,
             Seq<GeneratedExpression> operands,
             Seq<String> argTerms,
             Method wholeDocument,
             Method withPath) {
-        final ParsedJson parsed = getOrCreateParsedJson(ctx, argTerms.head() + 
".toString()");
+        final String parsed = JsonParseReuse.parseSharedInput(ctx, 
operands).resultTerm();
         if (argTerms.length() == 1) {
-            return new Tuple2<>(
-                    parsed.parseCode,
-                    CodeGenUtils.qualifyMethod(wholeDocument) + "(" + 
parsed.varName + ")");
+            return new Tuple2<>("", CodeGenUtils.qualifyMethod(wholeDocument) 
+ "(" + parsed + ")");
         }
 
         final String pathSpec = 
operands.apply(1).literalValue().get().toString();
         final boolean isPathDefinite = SqlJsonUtils.isPathDefinite(pathSpec);
         return new Tuple2<>(
-                parsed.parseCode,
+                "",

Review Comment:
   Now that `generateCallOnParsedInput()` always returns `""` as first param, 
you can remove the Tuple and change the return type to a plain string. 



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