clintropolis commented on code in PR #13803:
URL: https://github.com/apache/druid/pull/13803#discussion_r1141628246
##########
processing/src/main/java/org/apache/druid/segment/nested/CompressedNestedDataComplexColumn.java:
##########
@@ -380,9 +551,61 @@ public VectorObjectSelector
makeVectorObjectSelector(List<NestedPathPart> path,
if (fields.indexOf(field) >= 0) {
BaseColumn col = getColumnHolder(field).getColumn();
return col.makeVectorObjectSelector(readableOffset);
- } else {
- return NilVectorSelector.create(readableOffset);
}
+ if (!path.isEmpty() && path.get(path.size() - 1) instanceof
NestedPathArrayElement) {
+ final NestedPathPart lastPath = path.get(path.size() - 1);
+ final String arrayField = getField(path.subList(0, path.size() - 1));
+ if (fields.indexOf(arrayField) >= 0) {
+ final int elementNumber = ((NestedPathArrayElement)
lastPath).getIndex();
+ if (elementNumber < 0) {
+ throw new IAE("Cannot make array element selector for path [%s],
negative array index not supported for this selector", path);
+ }
+ DictionaryEncodedColumn<?> col = (DictionaryEncodedColumn<?>)
getColumnHolder(arrayField).getColumn();
+ VectorObjectSelector arraySelector =
col.makeVectorObjectSelector(readableOffset);
+
+ return new VectorObjectSelector()
+ {
+ private final Object[] elements = new
Object[arraySelector.getMaxVectorSize()];
+ private int id = ReadableVectorInspector.NULL_ID;
+
+ @Override
+ public Object[] getObjectVector()
+ {
+ if (readableOffset.getId() != id) {
+ final Object[] delegate = arraySelector.getObjectVector();
+ for (int i = 0; i < arraySelector.getCurrentVectorSize(); i++) {
Review Comment:
agree this isn't very optimized, i was planning to introduce some form of
array selector in a future PR to optimize selecting individual elements, for
now i was focusing on getting things functional.
--
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]