Airblader commented on a change in pull request #16691:
URL: https://github.com/apache/flink/pull/16691#discussion_r681742040



##########
File path: 
flink-table/flink-table-planner/src/main/java/org/apache/flink/table/planner/expressions/converter/CustomizedConvertRule.java
##########
@@ -411,6 +416,29 @@ private static RexNode convertSqrt(CallExpression call, 
ConvertContext context)
                                         
ApiExpressionUtils.valueLiteral(0.5))));
     }
 
+    private static RexNode convertJsonExists(CallExpression call, 
ConvertContext context) {
+        checkArgumentNumber(call, 2, 3);
+
+        final List<RexNode> operands = new LinkedList<>();
+        operands.add(context.toRexNode(call.getChildren().get(0)));
+        operands.add(context.toRexNode(call.getChildren().get(1)));
+
+        if (call.getChildren().size() >= 3) {
+            ((ValueLiteralExpression) call.getChildren().get(2))
+                    .getValueAs(JsonExistsOnError.class)
+                    .map(JsonExistsOnError::name)

Review comment:
       This currently relies on the fact that `JsonExistsOnError` (Flink) and 
`SqlJsonExistsErrorBehavior` (Calcite) name the enum constants the same. 
Unfortunately the Calcite enum is not available in flink-table-common (where 
`JsonExistsOnError` resides). 
   
   If we want to make this explicit (which I don't think is necessary – the SQL 
standard ain't gonna change on us) we'd have to keep a separate lookup map 
somewhere. In that case it would probably make sense to split up 
`CustomizdConvertRule` altogether into all of its individual parts (maybe a 
worthwhile change…?)




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