org.eigenbase.sql.fun
Class SqlSumEmptyIsZeroAggFunction

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.SqlSumEmptyIsZeroAggFunction
All Implemented Interfaces:
Aggregation

public class SqlSumEmptyIsZeroAggFunction
extends SqlAggFunction

Sum0 is an aggregator which returns the sum of the values which go into it like Sum. It differs in that when no non null values are applied zero is returned instead of null. Can be used along with Count to implement Sum.

Version:
$Id: //open/dev/farrago/src/org/eigenbase/sql/fun/SqlSumEmptyIsZeroAggFunction.java#4 $
Author:
jhahn

Field Summary
private  RelDataType type
           
 
Fields inherited from class org.eigenbase.sql.SqlOperator
MaxPrec, NL
 
Constructor Summary
SqlSumEmptyIsZeroAggFunction(RelDataType type)
           
 
Method Summary
 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()
           
 RelDataType getType()
           
 
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

type

private final RelDataType type
Constructor Detail

SqlSumEmptyIsZeroAggFunction

public SqlSumEmptyIsZeroAggFunction(RelDataType type)
Method Detail

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

getType

public RelDataType getType()

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