Class AggregatorInfo

java.lang.Object
org.apache.derby.impl.sql.execute.AggregatorInfo
All Implemented Interfaces:
Externalizable, Serializable, Formatable, TypedFormat

public class AggregatorInfo extends Object implements Formatable
This is a simple class used to store the run time information needed to invoke an aggregator. This class is serializable because it is stored with the plan. It is serializable rather than externalizable because it isn't particularly complicated and presumbably we don't need version control on plans.
See Also:
  • Field Details

    • aggregateName

      String aggregateName
      This class implements Formatable. That means that it can write itself to and from a formatted stream. If you add more fields to this class, make sure that you also write/read them with the writeExternal()/readExternal() methods. If, inbetween releases, you add more fields to this class, then you should bump the version number emitted by the getTypeFormatId() method. OR, since this is something that is used in stored prepared statements, it is ok to change it if you make sure that stored prepared statements are invalidated across releases.
    • inputColumn

      int inputColumn
    • outputColumn

      int outputColumn
    • aggregatorColumn

      int aggregatorColumn
    • aggregatorClassName

      String aggregatorClassName
    • isDistinct

      boolean isDistinct
    • rd

  • Constructor Details

    • AggregatorInfo

      public AggregatorInfo()
      Niladic constructor for Formattable
    • AggregatorInfo

      public AggregatorInfo(String aggregateName, String aggregatorClassName, int inputColNum, int outputColNum, int aggregatorColNum, boolean isDistinct, ResultDescription rd)
      Consructor
      Parameters:
      aggregateName - the name of the aggregate. Not actually used anywhere except diagnostics. Should be the names as found in the language (e.g. MAX).
      aggregatorClassName - the name of the aggregator used to process this aggregate. Aggregator expected to have a null arg constructor and implement Aggregator.
      inputColNum - the input column number
      outputColNum - the output column number
      aggregatorColNum - the column number in which the aggregator is stored.
      isDistinct - if it is a distinct aggregate
      rd - the result description
  • Method Details

    • getAggregateName

      public String getAggregateName()
      Get the name of the aggergate (e.g. MAX)
      Returns:
      the aggeregate name
    • getAggregatorClassName

      public String getAggregatorClassName()
      Get the name of the class that implements the user aggregator for this class.
      Returns:
      the aggeregator class name
    • getAggregatorColNum

      public int getAggregatorColNum()
      Get the column number for the aggregator column.
      Returns:
      the aggeregator colid
    • getInputColNum

      public int getInputColNum()
      Get the column number for the input (addend) column.
      Returns:
      the aggeregator colid
    • getOutputColNum

      public int getOutputColNum()
      Get the column number for the output (result) column.
      Returns:
      the aggeregator colid
    • isDistinct

      public boolean isDistinct()
      Is the aggergate distinct
      Returns:
      whether it is distinct
    • getResultDescription

      public ResultDescription getResultDescription()
      Get the result description for the input value to this aggregate.
      Returns:
      the rd
    • toString

      public String toString()
      Get a string for the object
      Overrides:
      toString in class Object
      Returns:
      string
    • writeExternal

      public void writeExternal(ObjectOutput out) throws IOException
      Write this object out
      Specified by:
      writeExternal in interface Externalizable
      Parameters:
      out - write bytes here
      Throws:
      IOException - thrown on error
    • readExternal

      public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
      Read this object from a stream of stored objects.
      Specified by:
      readExternal in interface Externalizable
      Parameters:
      in - read this.
      Throws:
      IOException - thrown on error
      ClassNotFoundException - thrown on error
    • getTypeFormatId

      public int getTypeFormatId()
      Get the formatID which corresponds to this class.
      Specified by:
      getTypeFormatId in interface TypedFormat
      Returns:
      the formatID of this class