Package io.trino.plugin.jdbc.aggregation
Class BaseImplementAvgBigint
java.lang.Object
io.trino.plugin.jdbc.aggregation.BaseImplementAvgBigint
- All Implemented Interfaces:
AggregateFunctionRule<JdbcExpression,ParameterizedExpression>
public abstract class BaseImplementAvgBigint
extends Object
implements AggregateFunctionRule<JdbcExpression,ParameterizedExpression>
Implements
avg(x) for bigint columns while preserving Trino semantics.
Trino semantics say the output should be a double but pushing down the aggregation to some databases
can result in rounding of the output to a bigint.-
Nested Class Summary
Nested classes/interfaces inherited from interface io.trino.plugin.base.aggregation.AggregateFunctionRule
AggregateFunctionRule.RewriteContext<ExpressionResult extends Object> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract StringImplement this method for each connector supporting avg(bigint) pushdownrewrite(AggregateFunction aggregateFunction, Captures captures, AggregateFunctionRule.RewriteContext<ParameterizedExpression> context)
-
Constructor Details
-
BaseImplementAvgBigint
public BaseImplementAvgBigint()
-
-
Method Details
-
getPattern
- Specified by:
getPatternin interfaceAggregateFunctionRule<JdbcExpression,ParameterizedExpression>
-
rewrite
public Optional<JdbcExpression> rewrite(AggregateFunction aggregateFunction, Captures captures, AggregateFunctionRule.RewriteContext<ParameterizedExpression> context) - Specified by:
rewritein interfaceAggregateFunctionRule<JdbcExpression,ParameterizedExpression>
-
getRewriteFormatExpression
Implement this method for each connector supporting avg(bigint) pushdown- Returns:
- A format string expression with a single placeholder for the column name; The string expression pushes down avg to the remote database
-