gianm commented on code in PR #19072:
URL: https://github.com/apache/druid/pull/19072#discussion_r2880675043
##########
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:
Yes, I meant if someone is searching for the bad keys. In that case the
behavior here doesn't adhere to the Indexed interface. If we're going to
deviate from it, that can be fine given it's only used in this specific place,
but any intentional deviation should be javadoc'd.
--
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]