Package com.qfs.agg

Interface IGenericAggregationFunction

All Superinterfaces:
IPluginValue, Serializable
All Known Subinterfaces:
IAggregationFunction, IHistoryAggregationFunction, IMultiSourceAggregationFunction, IUserDefinedAggregateFunction
All Known Implementing Classes:
AAggregationFunction, AGenericAggregationFunction, AGenericBaseAggregationFunction, AGenericVectorAggregationFunction, AMultiSourceAggregationFunction, AUserDefinedAggregateFunction, AUserDefinedAggregateFunctionWithRemoval, AVarianceAggregateFunction, AVectorAggregationFunction, AvgFunction, ComparableMaxFunction, CopyFunction, CountFunction, DistinctCountFunction, DistinctCountSupportingRemovalsFunction, GrossSumFunction, LongFunction, MaxFunction, MaxHistoryFunction, MedianFunction, MinFunction, MinHistoryFunction, MultiplyFunction, PercentileFunction, PopulationStdAggregateFunction, PopulationVarianceAggregateFunction, SampleStdAggregateFunction, SampleVarianceAggregateFunction, SerializableUserDefinedAggregateFunction, SerializableUserDefinedAggregateFunctionWithRemoval, SerializableUserDefinedVectorAggregateFunction, SerializableUserDefinedVectorAggregateFunctionWithRemoval, ShortFunction, SingleValueFunction, SquareSumFunction, SumFunction, SumProductFunction, TimestampFunction

public interface IGenericAggregationFunction extends IPluginValue, Serializable
Generic Aggregation function based on an arbitrary number of data sources.

It is recommended for clients implementing their own aggregation functions to either start with AAggregationFunction or AMultiSourceAggregationFunction.

Author:
ActiveViam
  • Field Details

    • SUM_PRODUCT_FUNCTION_PLUGIN_KEY

      static final String SUM_PRODUCT_FUNCTION_PLUGIN_KEY
      Plugin value key for an aggregation function that produces the sum product of the sources it is given.

      This aggregation is only defined for numerical types, nullable or not. null values will simply be skipped.

      This aggregation also accepts a single numerical vector type, as long as it comes last in the list of sources to aggregate.

      Example with table Trade:

       ┌─────────────────┬──────────┬───────┐
       │    Underlying  │ Quantity │ Value  │
       ├────────────────┼──────────┼────────┤
       │   AAPL         │    10    │  7.4   │
       │   AAPL         │    15    │  2.0   │
       │   AAPL        │     1     │  5.33  │
       │   AAPL        │     12    │  6.0   │
       └───────────────┴────────────────────┘
       
      SumProduct(Quantity, Value) will output:
         Result = 10 * 7.4 + 15 * 2.0 + 1 * 5.33 + 12 * 6.0 = 181.33
       
      See Also:
  • Method Details

    • getAggregatedType

      int getAggregatedType(int[] sourceTypes)
      Deduces the type of the result of the aggregation, based on the types of the sources of data.
      Parameters:
      sourceTypes - The data types of the elements to be aggregated
      Returns:
      the type of the result of this aggregation
    • createAggregation

      IGenericAggregation createAggregation(List<String> sourceIdentifiers, int[] sourceTypes)
      Creates an IGenericAggregation that can bind a list of data structures to a single destination data structure.

      The created aggregation is specialized for the given source identifiers, which can then be used to retrieve the correct source data structures to bind with a destination.

      The two given collections must have the same size.

      Parameters:
      sourceIdentifiers - A way to identify the source data structures
      sourceTypes - The data types of the elements to be aggregated
      Returns:
      the newly created aggregation, tailored for the given identifiers and types
    • withRemovalSupport

      IGenericAggregationFunction withRemovalSupport()
      Returns the function that supports removal, i.e. disaggregation operation for this function.
      Returns:
      The created aggregation function
    • getFunction

      static <T extends IGenericAggregationFunction> T getFunction(String pluginKey)
      Returns the IGenericAggregationFunction associated with this plugin using the input key.

      This method uses the current registry obtained through Registry.getRegistry().

      Parameters:
      pluginKey - The target function's plugin key
      Returns:
      The target function