snuyanzin commented on code in PR #28688:
URL: https://github.com/apache/flink/pull/28688#discussion_r3604998807


##########
flink-table/flink-table-planner/src/main/scala/org/apache/flink/table/planner/codegen/ExprCodeGenerator.scala:
##########
@@ -935,6 +935,20 @@ class ExprCodeGenerator(
           case BuiltInFunctionDefinitions.JSON_STRING =>
             new JsonStringCallGen(call, rexProgram).generate(ctx, operands, 
resultType)
 
+          case BuiltInFunctionDefinitions.JSON_LENGTH =>
+            generateCallWithStmtIfArgsNotNull(ctx, resultType, operands, 
resultNullable = true) {
+              argTerms =>
+                val inputTerm = s"${argTerms.head}.toString()"
+                val parsed = JsonCodeGenHelper.getOrCreateParsedJson(ctx, 
inputTerm)
+                val varName = parsed.varName
+                val (method, terms) =
+                  if (operands.length > 1)
+                    (BuiltInMethods.JSON_LENGTH_PATH, Seq(varName, 
s"${argTerms(1)}.toString()"))
+                  else
+                    (BuiltInMethods.JSON_LENGTH, Seq(varName))
+                (parsed.parseCode, 
s"${qualifyMethod(method)}(${terms.mkString(", ")})")

Review Comment:
   is there a reason we still have this code here?
   Didn't we say that it should be extracted in java class?



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