clintropolis commented on code in PR #13803:
URL: https://github.com/apache/druid/pull/13803#discussion_r1136483400


##########
processing/src/main/java/org/apache/druid/query/expression/NestedDataExpressions.java:
##########
@@ -480,11 +480,25 @@ public Expr apply(List<Expr> args)
       final StructuredDataProcessor processor = new StructuredDataProcessor()
       {
         @Override
-        public StructuredDataProcessor.ProcessedLiteral<?> 
processLiteralField(ArrayList<NestedPathPart> fieldPath, Object fieldValue)
+        public StructuredDataProcessor.ProcessedLiteral<?> 
processLiteralField(ArrayList<NestedPathPart> fieldPath, @Nullable Object 
fieldValue)
         {
           // do nothing, we only want the list of fields returned by this 
processor
           return StructuredDataProcessor.ProcessedLiteral.NULL_LITERAL;
         }
+
+        @Nullable
+        @Override
+        public ProcessedLiteral<?> processArrayOfLiteralsField(
+            ArrayList<NestedPathPart> fieldPath,
+            @Nullable Object maybeArrayOfLiterals
+        )
+        {
+          ExprEval<?> eval = ExprEval.bestEffortOf(maybeArrayOfLiterals);
+          if (eval.type().isArray() && 
eval.type().getElementType().isPrimitive()) {
+            return StructuredDataProcessor.ProcessedLiteral.NULL_LITERAL;
+          }

Review Comment:
   see other comment about the contracts of the process literal methods. Here 
the json_paths expression doesn't care about the literal size estimations, so 
it just ignores them, since all it is really looking for is the 
`StructuredDataProcessor.ProcessResults` to get the set of paths. Returning 
non-null on the array method means that the processing on that path stops, so 
the path is to the array, not a separate path for each array element.
   
   I'll try to explain a bit better with comments



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