org.eigenbase.sql.type
Class ExplicitReturnTypeInference

java.lang.Object
  extended by org.eigenbase.sql.type.ExplicitReturnTypeInference
All Implemented Interfaces:
SqlReturnTypeInference
Direct Known Subclasses:
TableFunctionReturnTypeInference

public class ExplicitReturnTypeInference
extends Object
implements SqlReturnTypeInference

A SqlReturnTypeInference which always returns the same SQL type.

Version:
$Id: //open/dev/farrago/src/org/eigenbase/sql/type/ExplicitReturnTypeInference.java#8 $
Author:
Wael Chatila

Field Summary
private  int argCount
           
private  int length
           
private  int scale
           
private  RelDataType type
           
private  SqlTypeName typeName
           
 
Constructor Summary
ExplicitReturnTypeInference(RelDataType type)
          Creates an inference rule which always returns the same type object.
ExplicitReturnTypeInference(SqlTypeName typeName)
          Creates an inference rule which always returns a given SQL type with zero parameters (such as DATE).
ExplicitReturnTypeInference(SqlTypeName typeName, int length)
          Creates an inference rule which always returns a given SQL type with a precision/length parameter (such as VARCHAR(10) and NUMBER(5)).
ExplicitReturnTypeInference(SqlTypeName typeName, int length, int scale)
          Creates an inference rule which always returns a given SQL type with a precision and scale parameters (such as DECIMAL(8, 3)).
 
Method Summary
private  RelDataType createType(RelDataTypeFactory typeFactory)
           
protected  RelDataType getExplicitType()
           
 RelDataType inferReturnType(SqlOperatorBinding opBinding)
          Infers the return type of a call to an SqlOperator.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

argCount

private final int argCount

typeName

private final SqlTypeName typeName

length

private final int length

scale

private final int scale

type

private final RelDataType type
Constructor Detail

ExplicitReturnTypeInference

public ExplicitReturnTypeInference(RelDataType type)
Creates an inference rule which always returns the same type object.

If the requesting type factory is different, returns a copy of the type object made using RelDataTypeFactory.copyType(RelDataType) within the requesting type factory.

REVIEW jvs 6-Aug-2006: Under what circumstances is a copy of the type required?

Parameters:
type - Type object

ExplicitReturnTypeInference

public ExplicitReturnTypeInference(SqlTypeName typeName)
Creates an inference rule which always returns a given SQL type with zero parameters (such as DATE).

Parameters:
typeName - Name of the type

ExplicitReturnTypeInference

public ExplicitReturnTypeInference(SqlTypeName typeName,
                                   int length)
Creates an inference rule which always returns a given SQL type with a precision/length parameter (such as VARCHAR(10) and NUMBER(5)).

Parameters:
typeName - Name of the type
length - Length or precision of the type

ExplicitReturnTypeInference

public ExplicitReturnTypeInference(SqlTypeName typeName,
                                   int length,
                                   int scale)
Creates an inference rule which always returns a given SQL type with a precision and scale parameters (such as DECIMAL(8, 3)).

Parameters:
typeName - Name of the type
length - Precision of the type
Method Detail

inferReturnType

public RelDataType inferReturnType(SqlOperatorBinding opBinding)
Description copied from interface: SqlReturnTypeInference
Infers the return type of a call to an SqlOperator.

Specified by:
inferReturnType in interface SqlReturnTypeInference
Parameters:
opBinding - description of operator binding
Returns:
inferred type

getExplicitType

protected RelDataType getExplicitType()

createType

private RelDataType createType(RelDataTypeFactory typeFactory)