Au-Miner commented on code in PR #28795:
URL: https://github.com/apache/flink/pull/28795#discussion_r3681352434


##########
flink-table/flink-table-planner/src/main/java/org/apache/flink/table/planner/plan/rules/logical/WrapJsonAggFunctionArgumentsRule.java:
##########
@@ -126,14 +123,16 @@ private Aggregate wrapJsonAggregate(Aggregate aggregate, 
RelBuilder relBuilder)
                 valueIndicesAfterProjection);
 
         List<AggregateCall> newWrappedArgCallList = new 
ArrayList<>(aggCallList);
-        final int newInputCount = inputCount + 
valueIndicesAfterProjection.size();
         for (Integer jsonAggCallIndex : wrapIndicesMap.keySet()) {
-            final TargetMapping argsMapping =
-                    Mappings.create(MappingType.BIJECTION, newInputCount, 
newInputCount);
-            Integer valueIndex = wrapIndicesMap.get(jsonAggCallIndex);
-            argsMapping.set(valueIndex, 
valueIndicesAfterProjection.get(valueIndex));
-            final AggregateCall newAggregateCall =
-                    
newWrappedArgCallList.get(jsonAggCallIndex).transform(argsMapping);
+            final AggregateCall aggregateCall = 
newWrappedArgCallList.get(jsonAggCallIndex);
+            final List<Integer> newArgList = new 
ArrayList<>(aggregateCall.getArgList());
+            // AggregateCall argument positions are zero-based: JSON_OBJECTAGG 
has (key, value),
+            // so its value is at position 1; JSON_ARRAYAGG has only (value), 
at position 0.
+            final int valueArgPosition =
+                    aggregateCall.getAggregation() instanceof 
SqlJsonObjectAggAggFunction ? 1 : 0;

Review Comment:
   solved



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