Top Description Fields Constructors Methods
org.apache.derby.impl.sql.compile

pack-priv Class UserAggregateDefinition

extends Object
implements AggregateDefinition
Class Inheritance
All Implemented Interfaces
org.apache.derby.impl.sql.compile.AggregateDefinition
Imports
org.apache.derby.catalog.types.AggregateAliasInfo, org.apache.derby.shared.common.error.StandardException, org.apache.derby.shared.common.reference.ClassName, .SQLState, org.apache.derby.iapi.services.context.ContextManager, .ContextService, org.apache.derby.iapi.services.loader.ClassFactory, org.apache.derby.iapi.sql.compile.CompilerContext, .TypeCompilerFactory, org.apache.derby.iapi.sql.dictionary.AliasDescriptor, org.apache.derby.iapi.types.DataTypeDescriptor, .JSQLType

Definition for user-defined aggregates.

Field Summary

Modifier and TypeField and Description
private AliasDescriptor
private static final int
private static final int
private static final String
private static final int
private static final int

Constructor Summary

AccessConstructor and Description
public
UserAggregateDefinition(AliasDescriptor alias)

Conjure out of thin air.

Method Summary

Modifier and TypeMethod and Description
private StandardException
aggregatorInstantiation(Throwable t)

Make a "Could not instantiate aggregator" exception.

pack-priv 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.

public final DataTypeDescriptor

Returns:

the result type of the user-defined aggregator
getAggregator
(DataTypeDescriptor
the input type
inputType
,
StringBuffer
(Output arg) the name of the Derby execution-time class which wraps the aggregate logic
aggregatorClass
)

Implements org.apache.derby.impl.sql.compile.AggregateDefinition.getAggregator.

Determines the result datatype and verifies that the input datatype is correct.

public AliasDescriptor
getAliasDescriptor()

Get the wrapped alias descriptor

private 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.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

_aliasback to summary
private AliasDescriptor _alias
AGGREGATOR_PARAM_COUNTback to summary
private static final int AGGREGATOR_PARAM_COUNT
AGGREGATOR_TYPEback to summary
private static final int AGGREGATOR_TYPE
DERBY_BYTE_ARRAY_NAMEback to summary
private static final String DERBY_BYTE_ARRAY_NAME
INPUT_TYPEback to summary
private static final int INPUT_TYPE
RETURN_TYPEback to summary
private static final int RETURN_TYPE

Constructor Detail

UserAggregateDefinitionback to summary
public UserAggregateDefinition(AliasDescriptor alias)

Conjure out of thin air.

Method Detail

aggregatorInstantiationback to summary
private StandardException aggregatorInstantiation(Throwable t)

Make a "Could not instantiate aggregator" exception.

castInputValueback to summary
pack-priv 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.

getAggregatorback to summary
public final DataTypeDescriptor getAggregator(DataTypeDescriptor inputType, StringBuffer aggregatorClass) throws StandardException

Implements org.apache.derby.impl.sql.compile.AggregateDefinition.getAggregator.

Determines the result datatype and verifies that the input datatype is correct.

Parameters
inputType:DataTypeDescriptor

the input type

aggregatorClass:StringBuffer

(Output arg) the name of the Derby execution-time class which wraps the aggregate logic

Returns:DataTypeDescriptor

the result type of the user-defined aggregator

getAliasDescriptorback to summary
public AliasDescriptor getAliasDescriptor()

Get the wrapped alias descriptor

getJavaClassback to summary
private Class<?> getJavaClass(ClassFactory classFactory, DataTypeDescriptor dtd) throws StandardException, ClassNotFoundException

Get the Java class corresponding to a Derby datatype.

vetCompatibilityback to summary
private void vetCompatibility(Class<?> actualClass, Class<?> expectedClass, String sqlState) throws StandardException

Verify that an actual type is compatible with the expected type.