use of com.yahoo.elide.core.exceptions.InvalidParameterizedAttributeException in project elide by yahoo.
the class SQLTimeDimensionProjection method getGrainFromArguments.
private TimeDimensionGrain getGrainFromArguments(Map<String, Argument> arguments, TimeDimension column) {
Argument grainArgument = arguments.get("grain");
if (grainArgument == null) {
return column.getDefaultGrain();
}
String grainName = grainArgument.getValue().toString().toLowerCase(Locale.ENGLISH);
return column.getSupportedGrains().stream().filter(grain -> grain.getGrain().name().toLowerCase(Locale.ENGLISH).equals(grainName)).findFirst().orElseThrow(() -> new InvalidParameterizedAttributeException(name, grainArgument));
}
Aggregations