gustavodemorais commented on code in PR #26474: URL: https://github.com/apache/flink/pull/26474#discussion_r2058574599
########## flink-table/flink-table-planner/src/main/scala/org/apache/flink/table/planner/codegen/JsonGenerateUtils.scala: ########## @@ -227,6 +227,23 @@ object JsonGenerateUtils { } } + /** + * Determines if the parameter index is % 2, which means checking that we only allow JSON calls + * for the VALUE parameter of a JSON_OBJECT call. + */ + def inValuesParamOfJsonObject(i: Int): Boolean = { + (i % 2) == 0 + } + + /** + * Determines whether a JSON function is allowed in the current context. JSON functions are + * allowed as values in JSON_ARRAY calls or as value parameters in JSON_OBJECT calls. + */ + def isSupportedJsonOperand(operand: RexNode, call: RexNode, i: Int): Boolean = { + isJsonFunctionOperand(operand) && + (isJsonArrayOperand(call) || isJsonObjectOperand(call) && inValuesParamOfJsonObject(i)) + } Review Comment: I usually try to use more code than comments to make it understandable and not run the risk of having it outdated eventually. But I see where you're coming from in this case 👍 It is indeed shorter to go with a comment here. I've moved the check and complemented the comment. [Take a look](https://github.com/apache/flink/pull/26474/commits/e30c207e371794adaac0261ed20a58a7c812f192) -- 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: issues-unsubscr...@flink.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org