Class ExtractionAwareDeltaFunction<DATA,TO>

java.lang.Object
org.apache.flink.streaming.api.functions.windowing.delta.ExtractionAwareDeltaFunction<DATA,TO>
Type Parameters:
DATA - The input data type. The input of this type will be passed to the extractor which will transform into a TO-object. The delta function then runs on this TO-object.
TO - The type on which the delta function runs. (The type of the delta function)
All Implemented Interfaces:
Serializable, DeltaFunction<DATA>
Direct Known Subclasses:
CosineDistance, EuclideanDistance

@PublicEvolving public abstract class ExtractionAwareDeltaFunction<DATA,TO> extends Object implements DeltaFunction<DATA>
Extend this abstract class to implement a delta function which is aware of extracting the data on which the delta is calculated from a more complex data structure. For example in case you want to be able to run a delta only on one field of a Tuple type or only on some fields from an array.
See Also:
  • Constructor Details

    • ExtractionAwareDeltaFunction

      public ExtractionAwareDeltaFunction(Extractor<DATA,TO> converter)
  • Method Details

    • getDelta

      public double getDelta(DATA oldDataPoint, DATA newDataPoint)
      This method takes the two data point and runs the set extractor on it. The delta function implemented at getNestedDelta(TO, TO) is then called with the extracted data. In case no extractor is set the input data gets passes to getNestedDelta(TO, TO) as-is. The return value is just forwarded from getNestedDelta(TO, TO).
      Specified by:
      getDelta in interface DeltaFunction<DATA>
      Parameters:
      oldDataPoint - the older data point as raw data (before extraction).
      newDataPoint - the new data point as raw data (before extraction).
      Returns:
      the delta between the two points.
    • getNestedDelta

      public abstract double getNestedDelta(TO oldDataPoint, TO newDataPoint)
      This method is exactly the same as DeltaFunction.getDelta(Object, Object) except that it gets the result of the previously done extractions as input. Therefore, this method only does the actual calculation of the delta but no data extraction or conversion.
      Parameters:
      oldDataPoint - the older data point.
      newDataPoint - the new data point.
      Returns:
      the delta between the two points.