use of io.trino.plugin.jdbc.JdbcExpression in project trino by trinodb.
the class ImplementSqlServerVariance method rewrite.
@Override
public Optional<JdbcExpression> rewrite(AggregateFunction aggregateFunction, Captures captures, RewriteContext<String> context) {
Variable argument = captures.get(ARGUMENT);
JdbcColumnHandle columnHandle = (JdbcColumnHandle) context.getAssignment(argument.getName());
verify(columnHandle.getColumnType().equals(DOUBLE));
verify(aggregateFunction.getOutputType().equals(DOUBLE));
return Optional.of(new JdbcExpression(format("VAR(%s)", context.rewriteExpression(argument).orElseThrow()), columnHandle.getJdbcTypeHandle()));
}
Aggregations