Search in sources :

Example 1 with RowCollectExpressionFactory

use of io.crate.metadata.expressions.RowCollectExpressionFactory in project crate by crate.

the class RowContextReferenceResolver method getImplementationByRootTraversal.

private static RowCollectExpression<?, ?> getImplementationByRootTraversal(Map<ColumnIdent, ? extends RowCollectExpressionFactory> innerFactories, ColumnIdent columnIdent) {
    RowCollectExpressionFactory factory = innerFactories.get(columnIdent.getRoot());
    if (factory == null) {
        return null;
    }
    ReferenceImplementation referenceImplementation = factory.create();
    for (String part : columnIdent.path()) {
        referenceImplementation = referenceImplementation.getChildImplementation(part);
        if (referenceImplementation == null) {
            return null;
        }
    }
    return (RowCollectExpression<?, ?>) referenceImplementation;
}
Also used : RowCollectExpressionFactory(io.crate.metadata.expressions.RowCollectExpressionFactory)

Example 2 with RowCollectExpressionFactory

use of io.crate.metadata.expressions.RowCollectExpressionFactory in project crate by crate.

the class RowContextReferenceResolver method rowCollectExpressionFromFactoryMap.

private static RowCollectExpression<?, ?> rowCollectExpressionFromFactoryMap(Map<TableIdent, Map<ColumnIdent, ? extends RowCollectExpressionFactory>> factoryMap, Reference info) {
    Map<ColumnIdent, ? extends RowCollectExpressionFactory> innerFactories = factoryMap.get(info.ident().tableIdent());
    if (innerFactories == null) {
        return null;
    }
    ColumnIdent columnIdent = info.ident().columnIdent();
    RowCollectExpressionFactory factory = innerFactories.get(columnIdent);
    if (factory != null) {
        return factory.create();
    }
    if (columnIdent.isColumn()) {
        return null;
    }
    return getImplementationByRootTraversal(innerFactories, columnIdent);
}
Also used : RowCollectExpressionFactory(io.crate.metadata.expressions.RowCollectExpressionFactory)

Aggregations

RowCollectExpressionFactory (io.crate.metadata.expressions.RowCollectExpressionFactory)2