gustavodemorais commented on code in PR #26474:
URL: https://github.com/apache/flink/pull/26474#discussion_r2055511354
##########
flink-table/flink-table-planner/src/main/scala/org/apache/flink/table/planner/codegen/ExprCodeGenerator.scala:
##########
@@ -489,7 +489,7 @@ class ExprCodeGenerator(ctx: CodeGeneratorContext,
nullableInput: Boolean)
// We only support JSON function operands as the value param of a
JSON_OBJECT or JSON_ARRAY function
case (operand: RexNode, i)
if isJsonFunctionOperand(operand) &&
- (isJsonArrayOperand(call) || i == 2 && isJsonObjectOperand(call))
=>
+ (isJsonArrayOperand(call) || isJsonObjectOperand(call) &&
inValuesParam(i)) =>
Review Comment:
Created a helper function called `isSupportedJsonOperand`
##########
flink-table/flink-table-planner/src/main/scala/org/apache/flink/table/planner/codegen/JsonGenerateUtils.scala:
##########
@@ -227,6 +227,14 @@ 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 inValuesParam(i: Int): Boolean = {
Review Comment:
I renamed it to inValuesParamOfJsonObject? I think the code is more readable
if you read `inValuesParamOfJsonObject` as part of the if condition than `i%2`
--
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]