use of org.springframework.data.cassandra.core.query.Columns.FunctionCall in project spring-data-cassandra by spring-projects.
the class QueryMapper method getMappedSelector.
private Selector getMappedSelector(Selector selector, CqlIdentifier cqlIdentifier) {
if (selector instanceof ColumnSelector) {
ColumnSelector columnSelector = (ColumnSelector) selector;
ColumnSelector mappedColumnSelector = ColumnSelector.from(cqlIdentifier);
return columnSelector.getAlias().map(mappedColumnSelector::as).orElse(mappedColumnSelector);
}
if (selector instanceof FunctionCall) {
FunctionCall functionCall = (FunctionCall) selector;
FunctionCall mappedFunctionCall = FunctionCall.from(functionCall.getExpression(), functionCall.getParameters().stream().map(obj -> {
if (obj instanceof Selector) {
return getMappedSelector((Selector) obj, cqlIdentifier);
}
return obj;
}).toArray());
return //
functionCall.getAlias().map(//
mappedFunctionCall::as).orElse(mappedFunctionCall);
}
throw new IllegalArgumentException(String.format("Selector [%s] not supported", selector));
}
Aggregations