twalthr commented on code in PR #28113:
URL: https://github.com/apache/flink/pull/28113#discussion_r3200832456


##########
flink-table/flink-table-planner/src/main/scala/org/apache/flink/table/planner/codegen/CodeGeneratorContext.scala:
##########
@@ -116,6 +115,41 @@ class CodeGeneratorContext(
   val reusableInputUnboxingExprs: mutable.Map[(String, Int), 
GeneratedExpression] =
     mutable.Map[(String, Int), GeneratedExpression]()
 
+  // map of expressions for shared RexProgram exprList entries that will be 
added only once
+  // exprList index -> expr
+  val reusableLocalRefExprs: mutable.LinkedHashMap[Int, GeneratedExpression] =

Review Comment:
   is this unused?



##########
flink-table/flink-table-planner/src/main/scala/org/apache/flink/table/planner/codegen/JsonGenerateUtils.scala:
##########
@@ -177,69 +178,50 @@ object JsonGenerateUtils {
     }
   }
 
-  /** Determines whether the given operand is a call to a JSON_OBJECT */
-  def isJsonObjectOperand(operand: RexNode): Boolean = {
-    operand match {
-      case rexCall: RexCall =>
-        rexCall.getOperator match {
-          case JSON_OBJECT => true
-          case _ => false
-        }
-      case _ => false
-    }
-  }
+  /** Determines whether the given operand is a call to a JSON_OBJECT. */
+  def isJsonObjectOperand(operand: RexNode, localRefs: 
java.util.List[RexNode]): Boolean =
+    ShortcutUtils.isOneOfFunctionDefinitions(
+      FlinkRexUtil.expandLocalRef(operand, localRefs),
+      BuiltInFunctionDefinitions.JSON_OBJECT)
 
-  /** Determines whether the given operand is a call to a JSON_ARRAY */
-  def isJsonArrayOperand(operand: RexNode): Boolean = {
-    operand match {
-      case rexCall: RexCall =>
-        rexCall.getOperator match {
-          case JSON_ARRAY => true
-          case _ => false
-        }
-      case _ => false
-    }
-  }
+  /** Determines whether the given operand is a call to a JSON_ARRAY. */
+  def isJsonArrayOperand(operand: RexNode, localRefs: 
java.util.List[RexNode]): Boolean =
+    ShortcutUtils.isOneOfFunctionDefinitions(
+      FlinkRexUtil.expandLocalRef(operand, localRefs),
+      BuiltInFunctionDefinitions.JSON_ARRAY)

Review Comment:
   Shouldn't we simple check with SqlKind here? It leaves the false impression 
that `ShortcutUtils.isOneOfFunctionDefinitions` can be used for all built-in 
operators. But this is not the case, only for very selected ones.



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