Copilot commented on code in PR #16306:
URL: https://github.com/apache/pinot/pull/16306#discussion_r2211854280


##########
pinot-core/src/main/java/org/apache/pinot/core/operator/transform/function/JsonExtractKeyTransformFunction.java:
##########
@@ -77,6 +76,19 @@ public void init(List<TransformFunction> arguments, 
Map<String, ColumnContext> c
     }
     _jsonFieldTransformFunction = firstArgument;
     _jsonPath = 
JsonPathCache.INSTANCE.getOrCompute(((LiteralTransformFunction) 
arguments.get(1)).getStringLiteral());
+
+    // Handle the optional third argument (optionalParameters)

Review Comment:
   The init method only handles the 3-argument case (paramString) for parsing 
maxDepth and dotNotation but does not handle the 4-argument signature 
(jsonExtractKey(json, path, maxDepth, dotNotation)). Add a branch for 
arguments.size() == 4 to parse the numeric and boolean literals separately.
   ```suggestion
       // Handle the optional third and fourth arguments
   ```



##########
pinot-core/src/main/java/org/apache/pinot/core/operator/transform/function/JsonExtractKeyTransformFunction.java:
##########
@@ -90,8 +102,24 @@ public String[][] transformToStringValuesMV(ValueBlock 
valueBlock) {
     initStringValuesMV(length);
     String[] jsonStrings = 
_jsonFieldTransformFunction.transformToStringValuesSV(valueBlock);
     for (int i = 0; i < length; i++) {
-      List<String> values = 
JSON_PARSER_CONTEXT.parse(jsonStrings[i]).read(_jsonPath);
-      _stringValuesMV[i] = values.toArray(new String[0]);
+      // Call the appropriate JsonFunctions method based on available 
parameters
+      List values;

Review Comment:
   [nitpick] Use a generic type for the list (e.g., List<String> values) to 
avoid raw types and improve type safety.
   ```suggestion
         List<String> values;
   ```



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to