Search in sources :

Example 1 with HasJoinVisitor

use of com.yahoo.elide.datastores.aggregation.queryengines.sql.expression.HasJoinVisitor in project elide by yahoo.

the class SubqueryFilterSplitter method visitPredicate.

@Override
public SplitFilter visitPredicate(FilterPredicate filterPredicate) {
    Type<?> tableType = filterPredicate.getEntityType();
    String fieldName = filterPredicate.getField();
    SQLTable table = metaDataStore.getTable(tableType);
    List<Reference> references = parser.parse(table, table.getColumnProjection(fieldName));
    boolean hasJoin = references.stream().anyMatch(ref -> ref.accept(new HasJoinVisitor()));
    if (hasJoin) {
        return SplitFilter.builder().outer(filterPredicate).build();
    }
    return SplitFilter.builder().inner(filterPredicate).build();
}
Also used : Reference(com.yahoo.elide.datastores.aggregation.queryengines.sql.expression.Reference) SQLTable(com.yahoo.elide.datastores.aggregation.queryengines.sql.metadata.SQLTable) HasJoinVisitor(com.yahoo.elide.datastores.aggregation.queryengines.sql.expression.HasJoinVisitor)

Aggregations

HasJoinVisitor (com.yahoo.elide.datastores.aggregation.queryengines.sql.expression.HasJoinVisitor)1 Reference (com.yahoo.elide.datastores.aggregation.queryengines.sql.expression.Reference)1 SQLTable (com.yahoo.elide.datastores.aggregation.queryengines.sql.metadata.SQLTable)1