org.eigenbase.sql.fun
Class SqlMinMaxAggFunction

java.lang.Object
  extended by org.eigenbase.sql.SqlOperator
      extended by org.eigenbase.sql.SqlFunction
          extended by org.eigenbase.sql.SqlAggFunction
              extended by org.eigenbase.sql.fun.SqlMinMaxAggFunction
All Implemented Interfaces:
Aggregation

public class SqlMinMaxAggFunction
extends SqlAggFunction

Definition of the MIN and MAX aggregate functions, returning the returns the smallest/largest of the values which go into it.

There are 3 forms:

sum(primitive type)
values are compared using <
sum(Comparable)
values are compared using Comparable.compareTo(T)
sum(Comparator, Object)
the Comparator.compare(T, T) method of the comparator is used to compare pairs of objects. The comparator is a startup argument, and must therefore be constant for the duration of the aggregation.

Version:
$Id: //open/dev/farrago/src/org/eigenbase/sql/fun/SqlMinMaxAggFunction.java#17 $
Author:
jhyde

Field Summary
 RelDataType[] argTypes
           
private  boolean isMin
           
private  int kind
           
static int MINMAX_COMPARABLE
           
static int MINMAX_COMPARATOR
           
static int MINMAX_INVALID
           
static int MINMAX_PRIMITIVE
           
 
Fields inherited from class org.eigenbase.sql.SqlOperator
MaxPrec, NL
 
Constructor Summary
SqlMinMaxAggFunction(RelDataType[] argTypes, boolean isMin, int kind)
           
 
Method Summary
 int getMinMaxKind()
           
 RelDataType[] getParameterTypes(RelDataTypeFactory typeFactory)
          Returns the parameter types accepted by this Aggregation.
 RelDataType getReturnType(RelDataTypeFactory typeFactory)
          Returns the type of the result yielded by this Aggregation.
 OJClass[] getStartParameterTypes()
           
 boolean isMin()
           
 
Methods inherited from class org.eigenbase.sql.SqlAggFunction
isQuantifierAllowed, validateCall
 
Methods inherited from class org.eigenbase.sql.SqlFunction
deriveType, getFunctionType, getNameAsId, getParamTypes, getSqlIdentifier, getSyntax, unparse, validateQuantifier
 
Methods inherited from class org.eigenbase.sql.SqlOperator
acceptCall, acceptCall, adjustType, argumentMustBeScalar, checkOperandCount, checkOperandTypes, createCall, createCall, createCall, createCall, equals, getAllowedSignatures, getAllowedSignatures, getKind, getLeftPrec, getMonotonicity, getName, getOperandCountRange, getOperandTypeChecker, getOperandTypeInference, getReturnTypeInference, getRightPrec, getSignatureTemplate, hashCode, inferReturnType, inferReturnType, isAggregator, isDeterministic, isDynamicFunction, isName, leftPrec, preValidateCall, requiresDecimalExpansion, rewriteCall, rightPrec, toString, unparseListClause, unparseListClause, validateOperands
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.eigenbase.rel.Aggregation
getName
 

Field Detail

MINMAX_INVALID

public static final int MINMAX_INVALID
See Also:
Constant Field Values

MINMAX_PRIMITIVE

public static final int MINMAX_PRIMITIVE
See Also:
Constant Field Values

MINMAX_COMPARABLE

public static final int MINMAX_COMPARABLE
See Also:
Constant Field Values

MINMAX_COMPARATOR

public static final int MINMAX_COMPARATOR
See Also:
Constant Field Values

argTypes

public final RelDataType[] argTypes

isMin

private final boolean isMin

kind

private final int kind
Constructor Detail

SqlMinMaxAggFunction

public SqlMinMaxAggFunction(RelDataType[] argTypes,
                            boolean isMin,
                            int kind)
Method Detail

isMin

public boolean isMin()

getMinMaxKind

public int getMinMaxKind()

getParameterTypes

public RelDataType[] getParameterTypes(RelDataTypeFactory typeFactory)
Description copied from interface: Aggregation
Returns the parameter types accepted by this Aggregation.

Parameters:
typeFactory - Type factory to create the types
Returns:
Array of parameter types

getReturnType

public RelDataType getReturnType(RelDataTypeFactory typeFactory)
Description copied from interface: Aggregation
Returns the type of the result yielded by this Aggregation.

Parameters:
typeFactory - Type factory to create the type
Returns:
Result type

getStartParameterTypes

public OJClass[] getStartParameterTypes()
Overrides:
getStartParameterTypes in class SqlAggFunction