use of com.yahoo.elide.datastores.aggregation.metadata.models.TimeDimensionGrain in project elide by yahoo.
the class MetaDataStore method addColumn.
/**
* Add a column metadata object.
*
* @param column column metadata
*/
private void addColumn(Column column) {
String version = column.getVersion();
if (!column.isHidden()) {
addMetaData(column, version);
}
if (column instanceof TimeDimension) {
TimeDimension timeDimension = (TimeDimension) column;
for (TimeDimensionGrain grain : timeDimension.getSupportedGrains()) {
addTimeDimensionGrain(grain, version);
}
}
column.getArgumentDefinitions().forEach(arg -> addArgument(arg, version));
}
use of com.yahoo.elide.datastores.aggregation.metadata.models.TimeDimensionGrain 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