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


##########
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:
   SqlKind will not help here as it is always `OTHER_FUNCTION`
   moved to `JsonGenerateUtils` and made use of check for `instanceof`



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