use of io.crate.operation.reference.NestedObjectExpression in project crate by crate.
the class SysObjectArrayReference method getChildImplementation.
@Override
public ReferenceImplementation<Object[]> getChildImplementation(String name) {
List<NestedObjectExpression> childImplementations = getChildImplementations();
final Object[] values = new Object[childImplementations.size()];
int i = 0;
for (NestedObjectExpression sysObjectReference : childImplementations) {
ReferenceImplementation<?> child = sysObjectReference.getChildImplementation(name);
if (child != null) {
Object value = child.value();
values[i++] = value;
} else {
values[i++] = null;
}
}
return () -> values;
}
use of io.crate.operation.reference.NestedObjectExpression in project crate by crate.
the class SysObjectArrayReference method value.
@Override
public Object[] value() {
List<NestedObjectExpression> childImplementations = getChildImplementations();
Object[] values = new Object[childImplementations.size()];
int i = 0;
for (NestedObjectExpression expression : childImplementations) {
Map<String, Object> map = Maps.transformValues(expression.getChildImplementations(), new Function<ReferenceImplementation, Object>() {
@Nullable
@Override
public Object apply(@Nullable ReferenceImplementation input) {
Object value = input.value();
if (value != null && value instanceof BytesRef) {
return ((BytesRef) value).utf8ToString();
} else {
return value;
}
}
});
values[i++] = map;
}
return values;
}
Aggregations