T - input valuepublic final class LastDatedValueFunction<T> extends org.apache.flink.table.functions.AggregateFunction<org.apache.flink.types.Row,LastDatedValueFunction.Accumulator<T>>
AggregateFunction that returns a row containing the latest non-null
value with its corresponding date.
The function uses a custom TypeInference and thus disables any of the default
reflection-based logic. It has a generic parameter T which will result in Object
(due to type erasure) during runtime. The TypeInference will provide the necessary
information how to call accumulate(...) for the given call in the query.
For code readability, we might use some internal utility methods that should rarely change. Implementers can copy those if they don't want to rely on non-official API.
| Modifier and Type | Class and Description |
|---|---|
static class |
LastDatedValueFunction.Accumulator<T>
Generic accumulator for representing state.
|
| Constructor and Description |
|---|
LastDatedValueFunction() |
| Modifier and Type | Method and Description |
|---|---|
void |
accumulate(LastDatedValueFunction.Accumulator<T> acc,
T input,
java.time.LocalDate date)
Generic runtime function that will be called with different kind of instances for
input depending on actual call in the query. |
LastDatedValueFunction.Accumulator<T> |
createAccumulator() |
org.apache.flink.table.types.inference.TypeInference |
getTypeInference(org.apache.flink.table.catalog.DataTypeFactory typeFactory)
Declares the
TypeInference of this function. |
org.apache.flink.types.Row |
getValue(LastDatedValueFunction.Accumulator<T> acc) |
getAccumulatorType, getResultTypeclose, functionIdentifier, open, toStringpublic org.apache.flink.table.types.inference.TypeInference getTypeInference(org.apache.flink.table.catalog.DataTypeFactory typeFactory)
TypeInference of this function. It specifies:
DataType.getConversionClass() should be used when calling the JVM method
accumulate(Accumulator, Object, LocalDate) during runtime,
getTypeInference in interface org.apache.flink.table.functions.FunctionDefinitiongetTypeInference in class org.apache.flink.table.functions.AggregateFunction<org.apache.flink.types.Row,LastDatedValueFunction.Accumulator<T>>public LastDatedValueFunction.Accumulator<T> createAccumulator()
createAccumulator in class org.apache.flink.table.functions.ImperativeAggregateFunction<org.apache.flink.types.Row,LastDatedValueFunction.Accumulator<T>>public void accumulate(LastDatedValueFunction.Accumulator<T> acc, T input, java.time.LocalDate date)
input depending on actual call in the query.public org.apache.flink.types.Row getValue(LastDatedValueFunction.Accumulator<T> acc)
getValue in class org.apache.flink.table.functions.AggregateFunction<org.apache.flink.types.Row,LastDatedValueFunction.Accumulator<T>>Copyright © 2014–2021 The Apache Software Foundation. All rights reserved.