You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by GitBox <gi...@apache.org> on 2021/07/28 03:32:16 UTC

[GitHub] [pinot] klsince commented on a change in pull request #7208: allow to extract values from array of objects with jsonPathArray

klsince commented on a change in pull request #7208:
URL: https://github.com/apache/pinot/pull/7208#discussion_r677946848



##########
File path: pinot-common/src/main/java/org/apache/pinot/common/function/scalar/JsonFunctions.java
##########
@@ -199,4 +207,47 @@ public static double jsonPathDouble(Object object, String jsonPath, double defau
       return defaultValue;
     }
   }
+
+  static class ArrayAwareJacksonJsonProvider extends JacksonJsonProvider {
+    @Override
+    public boolean isArray(Object obj) {
+      return (obj instanceof List) || (obj instanceof Object[]);
+    }
+
+    @Override
+    public Object getArrayIndex(Object obj, int idx) {
+      if (obj instanceof Object[]) {
+        return ((Object[]) obj)[idx];
+      }
+      return super.getArrayIndex(obj, idx);
+    }
+
+    @Override
+    public void setArrayIndex(Object obj, int index, Object newValue) {

Review comment:
       looks like it's mainly for updating JSON object, like adding or setting a value at certain json path. Don't think it's needed for here, removing for now. 




-- 
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: commits-unsubscribe@pinot.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org