Class JavaAggregate

All Implemented Interfaces:
HasSQL, Typed

public class JavaAggregate extends AbstractAggregate
This class wraps a user-defined aggregate.
  • Field Details

    • userAggregate

      private final UserAggregate userAggregate
    • argTypes

      private int[] argTypes
    • dataType

      private int dataType
    • userConnection

      private JdbcConnection userConnection
  • Constructor Details

  • Method Details

    • getCost

      public int getCost()
      Description copied from class: Expression
      Estimate the cost to process the expression. Used when optimizing the query, to calculate the query plan with the lowest estimated cost.
      Specified by:
      getCost in class Expression
      Returns:
      the estimated cost
    • getUnenclosedSQL

      public StringBuilder getUnenclosedSQL(StringBuilder builder, int sqlFlags)
      Description copied from class: Expression
      Get the SQL statement of this expression. This may not always be the original SQL statement, especially after optimization. Enclosing '(' and ')' are never appended.
      Specified by:
      getUnenclosedSQL in class Expression
      Parameters:
      builder - string builder
      sqlFlags - formatting flags
      Returns:
      the specified string builder
    • isEverything

      public boolean isEverything(ExpressionVisitor visitor)
      Description copied from class: Expression
      Check if this expression and all sub-expressions can fulfill a criteria. If any part returns false, the result is false.
      Overrides:
      isEverything in class DataAnalysisOperation
      Parameters:
      visitor - the visitor
      Returns:
      if the criteria can be fulfilled
    • optimize

      public Expression optimize(SessionLocal session)
      Description copied from class: Expression
      Try to optimize the expression.
      Overrides:
      optimize in class AbstractAggregate
      Parameters:
      session - the session
      Returns:
      the optimized expression
    • getInstance

      private Aggregate getInstance()
    • getAggregatedValue

      public Value getAggregatedValue(SessionLocal session, Object aggregateData)
      Description copied from class: DataAnalysisOperation
      Returns aggregated value.
      Specified by:
      getAggregatedValue in class DataAnalysisOperation
      Parameters:
      session - the session
      aggregateData - the aggregate data
      Returns:
      aggregated value.
    • updateAggregate

      protected void updateAggregate(SessionLocal session, Object aggregateData)
      Description copied from class: AbstractAggregate
      Updates an aggregate value.
      Specified by:
      updateAggregate in class AbstractAggregate
      Parameters:
      session - the session
      aggregateData - aggregate data
    • updateData

      private void updateData(SessionLocal session, Object aggregateData, Value[] remembered)
    • updateGroupAggregates

      protected void updateGroupAggregates(SessionLocal session, int stage)
      Description copied from class: DataAnalysisOperation
      Invoked when processing group stage of grouped window queries to update arguments of this aggregate.
      Overrides:
      updateGroupAggregates in class AbstractAggregate
      Parameters:
      session - the session
      stage - select stage
    • getNumExpressions

      protected int getNumExpressions()
      Description copied from class: DataAnalysisOperation
      Returns the number of expressions, excluding OVER clause.
      Specified by:
      getNumExpressions in class DataAnalysisOperation
      Returns:
      the number of expressions
    • rememberExpressions

      protected void rememberExpressions(SessionLocal session, Value[] array)
      Description copied from class: DataAnalysisOperation
      Stores current values of expressions into the specified array.
      Specified by:
      rememberExpressions in class DataAnalysisOperation
      Parameters:
      session - the session
      array - array to store values of expressions
    • updateFromExpressions

      protected void updateFromExpressions(SessionLocal session, Object aggregateData, Value[] array)
      Description copied from class: AbstractAggregate
      Updates the provided aggregate data from the remembered expressions.
      Specified by:
      updateFromExpressions in class AbstractAggregate
      Parameters:
      session - the session
      aggregateData - aggregate data
      array - values of expressions
    • createAggregateData

      protected Object createAggregateData()
      Description copied from class: DataAnalysisOperation
      Create aggregate data object specific to the subclass.
      Specified by:
      createAggregateData in class DataAnalysisOperation
      Returns:
      aggregate-specific data object.