cecemei commented on code in PR #18948:
URL: https://github.com/apache/druid/pull/18948#discussion_r2723030675
##########
processing/src/main/java/org/apache/druid/segment/nested/CompressedNestedDataComplexColumn.java:
##########
@@ -1043,8 +1044,17 @@ public boolean isNumeric(List<NestedPathPart> path)
if (field instanceof NestedField) {
final NestedField nestedField = (NestedField) field;
return getColumnHolder(nestedField.fieldName,
nestedField.fieldIndex).getCapabilities().isNumeric();
+ } else if (field instanceof NestedArrayElement) {
+ final NestedArrayElement element = (NestedArrayElement) field;
+ final TypeSignature<ValueType> elementType = getColumnHolder(
+ element.nestedField.fieldName,
+ element.nestedField.fieldIndex
+ ).getCapabilities().getElementType();
+ if (elementType != null) {
+ return elementType.isNumeric();
+ }
Review Comment:
would be helpful to add some explanation here say if elementType not
derived, we dont know this field is numeric or not... also might be just more
readable return false directly after the if statement.
##########
processing/src/main/java/org/apache/druid/segment/nested/CompressedNestedDataComplexColumn.java:
##########
@@ -1043,8 +1044,17 @@ public boolean isNumeric(List<NestedPathPart> path)
if (field instanceof NestedField) {
final NestedField nestedField = (NestedField) field;
return getColumnHolder(nestedField.fieldName,
nestedField.fieldIndex).getCapabilities().isNumeric();
+ } else if (field instanceof NestedArrayElement) {
+ final NestedArrayElement element = (NestedArrayElement) field;
+ final TypeSignature<ValueType> elementType = getColumnHolder(
+ element.nestedField.fieldName,
+ element.nestedField.fieldIndex
+ ).getCapabilities().getElementType();
+ if (elementType != null) {
+ return elementType.isNumeric();
+ }
}
- return true;
+ return field == null;
Review Comment:
would be more readable if this just returns true (and return false as i
commented above). also might be helpful adding explanation like this field
doesnt exist, thus we can vectorized....
--
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]