org.apache.derby.impl.sql.compile
Class UserAggregateDefinition

java.lang.Object
  extended by org.apache.derby.impl.sql.compile.UserAggregateDefinition
All Implemented Interfaces:
AggregateDefinition

public class UserAggregateDefinition
extends java.lang.Object
implements AggregateDefinition

Definition for user-defined aggregates.


Field Summary
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
UserAggregateDefinition(AliasDescriptor alias)
          Conjure out of thin air.
 
Method Summary
private  StandardException aggregatorInstantiation(java.lang.Throwable t)
          Make a "Could not instantiate aggregator" exception.
 ValueNode castInputValue(ValueNode inputValue, NodeFactory nodeFactory, 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 descriptor
private  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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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 interface AggregateDefinition
Parameters:
inputType - the input type
aggregatorClass - (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

public final ValueNode castInputValue(ValueNode inputValue,
                                      NodeFactory nodeFactory,
                                      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.


Built on Wed 2013-06-12 15:21:56+0000, from revision ???

Apache Derby V10.10 Internals - Copyright © 2004,2013 The Apache Software Foundation. All Rights Reserved.