use of com.yahoo.elide.datastores.aggregation.query.ColumnProjection in project elide by yahoo.
the class SQLTimeDimensionProjection method nest.
@Override
public Pair<ColumnProjection, Set<ColumnProjection>> nest(Queryable source, MetaDataStore store, boolean joinInOuter) {
List<Reference> references = new ExpressionParser(store).parse(source, getExpression());
boolean requiresJoin = SQLColumnProjection.requiresJoin(references);
String columnId = source.isRoot() ? getName() : getAlias();
boolean inProjection = source.getColumnProjection(columnId, getArguments(), true) != null;
ColumnProjection outerProjection;
Set<ColumnProjection> innerProjections;
if (requiresJoin && joinInOuter) {
String outerProjectionExpression = toPhysicalReferences(source, store);
outerProjection = withExpression(outerProjectionExpression, inProjection);
innerProjections = SQLColumnProjection.extractPhysicalReferences(source, references, store);
} else {
outerProjection = SQLTimeDimensionProjection.builder().name(name).alias(alias).valueType(valueType).columnType(columnType).grain(new TimeDimensionGrain(this.getName(), grain.getGrain())).expression("{{$" + this.getSafeAlias() + "}}").projected(isProjected()).arguments(arguments).timeZone(timeZone).build();
innerProjections = new LinkedHashSet<>(Arrays.asList(this));
}
return Pair.of(outerProjection, innerProjections);
}
Aggregations