public abstract class LeadLagAggFunction extends DeclarativeAggregateFunction
LAG(input, offset, default) - Returns the value of `input` at the `offset`th row before the current row in the window. The default value of `offset` is 1 and the default value of `default` is null. If the value of `input` at the `offset`th row is null, null is returned. If there is no such offset row (e.g., when the offset is 1, the first row of the window does not have any previous row), `default` is returned.
LEAD(input, offset, default) - Returns the value of `input` at the `offset`th row after the current row in the window. The default value of `offset` is 1 and the default value of `default` is null. If the value of `input` at the `offset`th row is null, null is returned. If there is no such an offset row (e.g., when the offset is 1, the last row of the window does not have any subsequent row), `default` is returned.
These two aggregate functions are special, and only are used by over window. So here the
concrete implementation is closely related to OffsetOverFrame
.
Modifier and Type | Class and Description |
---|---|
static class |
LeadLagAggFunction.BooleanLeadLagAggFunction
BooleanLeadLagAggFunction.
|
static class |
LeadLagAggFunction.ByteLeadLagAggFunction
ByteLeadLagAggFunction.
|
static class |
LeadLagAggFunction.CharLeadLagAggFunction
CharLeadLagAggFunction.
|
static class |
LeadLagAggFunction.DateLeadLagAggFunction
DateLeadLagAggFunction.
|
static class |
LeadLagAggFunction.DecimalLeadLagAggFunction
DecimalLeadLagAggFunction.
|
static class |
LeadLagAggFunction.DoubleLeadLagAggFunction
DoubleLeadLagAggFunction.
|
static class |
LeadLagAggFunction.FloatLeadLagAggFunction
FloatLeadLagAggFunction.
|
static class |
LeadLagAggFunction.IntLeadLagAggFunction
IntLeadLagAggFunction.
|
static class |
LeadLagAggFunction.LongLeadLagAggFunction
LongLeadLagAggFunction.
|
static class |
LeadLagAggFunction.ShortLeadLagAggFunction
ShortLeadLagAggFunction.
|
static class |
LeadLagAggFunction.StringLeadLagAggFunction
StringLeadLagAggFunction.
|
static class |
LeadLagAggFunction.TimeLeadLagAggFunction
TimeLeadLagAggFunction.
|
static class |
LeadLagAggFunction.TimestampLeadLagAggFunction
TimestampLeadLagAggFunction.
|
Constructor and Description |
---|
LeadLagAggFunction(int operandCount) |
Modifier and Type | Method and Description |
---|---|
Expression[] |
accumulateExpressions()
Expressions for accumulating the mutable aggregation buffer based on an input row.
|
UnresolvedReferenceExpression[] |
aggBufferAttributes()
All fields of the aggregate buffer.
|
DataType[] |
getAggBufferTypes()
All types of the aggregate buffer.
|
Expression |
getValueExpression()
An expression which returns the final value for this aggregate function.
|
Expression[] |
initialValuesExpressions()
Expressions for initializing empty aggregation buffers.
|
Expression[] |
mergeExpressions()
A sequence of expressions for merging two aggregation buffers together.
|
int |
operandCount()
How many operands your function will deal with.
|
Expression[] |
retractExpressions()
Expressions for retracting the mutable aggregation buffer based on an input row.
|
getKind, getResultType, getTypeInference, mergeOperand, mergeOperands, operand, operands
close, functionIdentifier, open, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getRequirements, isDeterministic, supportsConstantFolding
public int operandCount()
DeclarativeAggregateFunction
operandCount
in class DeclarativeAggregateFunction
public UnresolvedReferenceExpression[] aggBufferAttributes()
DeclarativeAggregateFunction
aggBufferAttributes
in class DeclarativeAggregateFunction
public DataType[] getAggBufferTypes()
DeclarativeAggregateFunction
getAggBufferTypes
in class DeclarativeAggregateFunction
public Expression[] initialValuesExpressions()
DeclarativeAggregateFunction
initialValuesExpressions
in class DeclarativeAggregateFunction
public Expression[] accumulateExpressions()
DeclarativeAggregateFunction
accumulateExpressions
in class DeclarativeAggregateFunction
public Expression[] retractExpressions()
DeclarativeAggregateFunction
retractExpressions
in class DeclarativeAggregateFunction
public Expression[] mergeExpressions()
DeclarativeAggregateFunction
attributeName
and mergeOperand(attributeName)
to refer to the attributes corresponding to each of the buffers
being merged.mergeExpressions
in class DeclarativeAggregateFunction
public Expression getValueExpression()
DeclarativeAggregateFunction
getValueExpression
in class DeclarativeAggregateFunction
Copyright © 2014–2024 The Apache Software Foundation. All rights reserved.