Class UserAggregateDefinition
java.lang.Object
org.apache.derby.impl.sql.compile.UserAggregateDefinition
- All Implemented Interfaces:
AggregateDefinition
Definition for user-defined aggregates.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate AliasDescriptor
private static final int
private static final int
private static final String
private static final int
private static final int
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate StandardException
Make a "Could not instantiate aggregator" exception.(package private) final 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.final DataTypeDescriptor
getAggregator
(DataTypeDescriptor inputType, StringBuffer aggregatorClass) Determines the result datatype and verifies that the input datatype is correct.Get the wrapped alias descriptorprivate Class
<?> getJavaClass
(ClassFactory classFactory, DataTypeDescriptor dtd) Get the Java class corresponding to a Derby datatype.private void
vetCompatibility
(Class<?> actualClass, Class<?> expectedClass, String sqlState) Verify that an actual type is compatible with the expected type.
-
Field Details
-
INPUT_TYPE
private static final int INPUT_TYPE- See Also:
-
RETURN_TYPE
private static final int RETURN_TYPE- See Also:
-
AGGREGATOR_TYPE
private static final int AGGREGATOR_TYPE- See Also:
-
AGGREGATOR_PARAM_COUNT
private static final int AGGREGATOR_PARAM_COUNT- See Also:
-
DERBY_BYTE_ARRAY_NAME
- See Also:
-
_alias
-
-
Constructor Details
-
UserAggregateDefinition
Conjure out of thin air.
-
-
Method Details
-
getAliasDescriptor
Get the wrapped alias descriptor -
getAggregator
public final DataTypeDescriptor getAggregator(DataTypeDescriptor inputType, 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:
-
vetCompatibility
private void vetCompatibility(Class<?> actualClass, Class<?> expectedClass, String sqlState) throws StandardException Verify that an actual type is compatible with the expected type.- Throws:
StandardException
-
castInputValue
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 Class<?> getJavaClass(ClassFactory classFactory, DataTypeDescriptor dtd) throws StandardException, ClassNotFoundException Get the Java class corresponding to a Derby datatype. -
aggregatorInstantiation
Make a "Could not instantiate aggregator" exception.
-