Search in sources :

Example 1 with RowCollectExpression

use of io.crate.metadata.RowCollectExpression in project crate by crate.

the class RowCollectNestedObjectExpression method value.

@Override
public Map<String, Object> value() {
    Map<String, Object> map = new HashMap<>(childImplementations.size());
    for (Map.Entry<String, ReferenceImplementation> e : childImplementations.entrySet()) {
        ReferenceImplementation referenceImplementation = e.getValue();
        if (referenceImplementation instanceof RowCollectExpression) {
            //noinspection unchecked
            ((RowCollectExpression) referenceImplementation).setNextRow(this.row);
        }
        Object value = referenceImplementation.value();
        // as we do not want to convert them when building the response
        if (value instanceof BytesRef) {
            value = ((BytesRef) value).utf8ToString();
        }
        map.put(e.getKey(), value);
    }
    return Collections.unmodifiableMap(map);
}
Also used : HashMap(java.util.HashMap) RowCollectExpression(io.crate.metadata.RowCollectExpression) Map(java.util.Map) HashMap(java.util.HashMap) BytesRef(org.apache.lucene.util.BytesRef) ReferenceImplementation(io.crate.metadata.ReferenceImplementation)

Aggregations

ReferenceImplementation (io.crate.metadata.ReferenceImplementation)1 RowCollectExpression (io.crate.metadata.RowCollectExpression)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 BytesRef (org.apache.lucene.util.BytesRef)1