Class UserAggregateDefinition
- java.lang.Object
-
- org.apache.derby.impl.sql.compile.UserAggregateDefinition
-
- All Implemented Interfaces:
AggregateDefinition
class UserAggregateDefinition extends java.lang.Object implements AggregateDefinition
Definition for user-defined aggregates.
-
-
Field Summary
Fields Modifier and Type Field Description private AliasDescriptor
_alias
private static int
AGGREGATOR_PARAM_COUNT
private static int
AGGREGATOR_TYPE
private static java.lang.String
DERBY_BYTE_ARRAY_NAME
private static int
INPUT_TYPE
private static int
RETURN_TYPE
-
Constructor Summary
Constructors Constructor Description UserAggregateDefinition(AliasDescriptor alias)
Conjure out of thin air.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private StandardException
aggregatorInstantiation(java.lang.Throwable t)
Make a "Could not instantiate aggregator" exception.(package private) ValueNode
castInputValue(ValueNode inputValue, ContextManager cm)
Wrap the input operand in an implicit CAST node as necessary in order to coerce it the correct type for the aggregator.DataTypeDescriptor
getAggregator(DataTypeDescriptor inputType, java.lang.StringBuffer aggregatorClass)
Determines the result datatype and verifies that the input datatype is correct.AliasDescriptor
getAliasDescriptor()
Get the wrapped alias descriptorprivate java.lang.Class<?>
getJavaClass(ClassFactory classFactory, DataTypeDescriptor dtd)
Get the Java class corresponding to a Derby datatype.private void
vetCompatibility(java.lang.Class<?> actualClass, java.lang.Class<?> expectedClass, java.lang.String sqlState)
Verify that an actual type is compatible with the expected type.
-
-
-
Field Detail
-
INPUT_TYPE
private static final int INPUT_TYPE
- See Also:
- Constant Field Values
-
RETURN_TYPE
private static final int RETURN_TYPE
- See Also:
- Constant Field Values
-
AGGREGATOR_TYPE
private static final int AGGREGATOR_TYPE
- See Also:
- Constant Field Values
-
AGGREGATOR_PARAM_COUNT
private static final int AGGREGATOR_PARAM_COUNT
- See Also:
- Constant Field Values
-
DERBY_BYTE_ARRAY_NAME
private static final java.lang.String DERBY_BYTE_ARRAY_NAME
- See Also:
- Constant Field Values
-
_alias
private AliasDescriptor _alias
-
-
Constructor Detail
-
UserAggregateDefinition
public UserAggregateDefinition(AliasDescriptor alias)
Conjure out of thin air.
-
-
Method Detail
-
getAliasDescriptor
public AliasDescriptor getAliasDescriptor()
Get the wrapped alias descriptor
-
getAggregator
public final DataTypeDescriptor getAggregator(DataTypeDescriptor inputType, java.lang.StringBuffer aggregatorClass) throws StandardException
Determines the result datatype and verifies that the input datatype is correct.- Specified by:
getAggregator
in interfaceAggregateDefinition
- Parameters:
inputType
- the input typeaggregatorClass
- (Output arg) the name of the Derby execution-time class which wraps the aggregate logic- Returns:
- the result type of the user-defined aggregator
- Throws:
StandardException
- See Also:
TypeDescriptor
-
vetCompatibility
private void vetCompatibility(java.lang.Class<?> actualClass, java.lang.Class<?> expectedClass, java.lang.String sqlState) throws StandardException
Verify that an actual type is compatible with the expected type.- Throws:
StandardException
-
castInputValue
final ValueNode castInputValue(ValueNode inputValue, ContextManager cm) throws StandardException
Wrap the input operand in an implicit CAST node as necessary in order to coerce it the correct type for the aggregator. Return null if no cast is necessary.- Throws:
StandardException
-
getJavaClass
private java.lang.Class<?> getJavaClass(ClassFactory classFactory, DataTypeDescriptor dtd) throws StandardException, java.lang.ClassNotFoundException
Get the Java class corresponding to a Derby datatype.- Throws:
StandardException
java.lang.ClassNotFoundException
-
aggregatorInstantiation
private StandardException aggregatorInstantiation(java.lang.Throwable t)
Make a "Could not instantiate aggregator" exception.
-
-