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


##########
processing/src/main/java/org/apache/druid/segment/nested/NestedDataColumnSupplier.java:
##########
@@ -268,4 +312,87 @@ public <T> T as(Class<T> clazz)
     }
     return null;
   }
+
+  @VisibleForTesting
+  public static class FieldsFixupIndexed implements Indexed<ByteBuffer>
+  {
+    private final Indexed<ByteBuffer> delegate;
+    private final Int2ObjectMap<ByteBuffer> fixup;
+
+    private FieldsFixupIndexed(Indexed<ByteBuffer> delegate, 
Int2ObjectMap<ByteBuffer> fixup)
+    {
+      this.delegate = delegate;
+      this.fixup = fixup;
+    }
+
+    @Override
+    public int size()
+    {
+      return delegate.size();
+    }
+
+    @Nullable
+    @Override
+    public ByteBuffer get(int index)
+    {
+      if (fixup.containsKey(index)) {
+        return fixup.get(index).asReadOnlyBuffer();
+      }
+      return delegate.get(index);
+    }
+
+    @Override
+    public int indexOf(@Nullable ByteBuffer value)
+    {
+      for (Int2ObjectMap.Entry<ByteBuffer> entry : fixup.int2ObjectEntrySet()) 
{
+        if (entry.getValue().equals(value)) {
+          return entry.getIntKey();
+        }
+      }
+      return delegate.indexOf(value);

Review Comment:
   Do you mean like if a caller is searching for the bad keys? I don't think 
that should be possible for most callers since when calling this method we 
generally run it through `NestedPathFinder.toNormalizedJsonPath` before 
searching because usually at the point we call this the path expressions have 
been converted to `List<NestedPathPart>` during SQL planning.
   
   Also, i believe it should be harmless for `indexOf` to report the positions 
of the bad paths if using the bad path expressions.
   
   Added explanation to javadocs



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