com.lucidera.type
Class LucidDbTypeFactory

java.lang.Object
  extended by org.eigenbase.reltype.RelDataTypeFactoryImpl
      extended by org.eigenbase.sql.type.SqlTypeFactoryImpl
          extended by org.eigenbase.oj.OJTypeFactoryImpl
              extended by net.sf.farrago.type.FarragoTypeFactoryImpl
                  extended by com.lucidera.type.LucidDbTypeFactory
All Implemented Interfaces:
FarragoTypeFactory, OJTypeFactory, RelDataTypeFactory

public class LucidDbTypeFactory
extends FarragoTypeFactoryImpl

LucidDbTypeFactory overrides FarragoTypeFactoryImpl with LucidDB-specific type derivation rules.

Version:
$Id: //open/dev/farrago/src/com/lucidera/type/LucidDbTypeFactory.java#10 $
Author:
John Pham

Nested Class Summary
 
Nested classes/interfaces inherited from class org.eigenbase.reltype.RelDataTypeFactoryImpl
RelDataTypeFactoryImpl.JavaType
 
Nested classes/interfaces inherited from interface org.eigenbase.reltype.RelDataTypeFactory
RelDataTypeFactory.FieldInfo, RelDataTypeFactory.ListFieldInfo
 
Field Summary
static int DECIMAL_PRODUCT_SCALE_CAP
          Cap applied to the scale of a decimal multiplication product, if the product's ideal precision is too high to be supported by LucidDb.
static int DECIMAL_QUOTIENT_SCALE_CAP
          Cap applied to the scale of a decimal division quotient.
 
Fields inherited from class org.eigenbase.oj.OJTypeFactoryImpl
mapOJClassToType
 
Constructor Summary
LucidDbTypeFactory(FarragoRepos repos)
           
 
Method Summary
 RelDataType createDecimalProduct(RelDataType type1, RelDataType type2)
          Similar to RelDataTypeFactoryImpl.createDecimalProduct(org.eigenbase.reltype.RelDataType, org.eigenbase.reltype.RelDataType) but caps the maximum scale at DECIMAL_PRODUCT_SCALE_CAP.
 RelDataType createDecimalQuotient(RelDataType type1, RelDataType type2)
          Similar to RelDataTypeFactoryImpl.createDecimalQuotient(org.eigenbase.reltype.RelDataType, org.eigenbase.reltype.RelDataType) but caps the maximum scale at DECIMAL_QUOTIENT_SCALE_CAP.
protected  boolean shouldRaggedFixedLengthValueUnionBeVariable()
          Controls behavior discussed here.
 boolean useDoubleMultiplication(RelDataType type1, RelDataType type2)
           
 
Methods inherited from class net.sf.farrago.type.FarragoTypeFactoryImpl
createCwmElementType, createCwmType, createCwmTypeImpl, createJavaType, createJdbcColumnType, createJdbcColumnType, createJoinType, createMofType, createResultSetType, createResultSetType, createSqlType, createSqlType, createSqlType, createStructTypeFromClassifier, getClassForJavaParamStyle, getClassForPrimitive, getDefaultCharset, getRepos, getValueAccessExpression, toOJClass
 
Methods inherited from class org.eigenbase.oj.OJTypeFactoryImpl
createArrayType, createOJClassForRecordType, toType
 
Methods inherited from class org.eigenbase.sql.type.SqlTypeFactoryImpl
canonize, createMultisetType, createSqlIntervalType, createTypeWithCharsetAndCollation, createTypeWithNullability, leastRestrictive
 
Methods inherited from class org.eigenbase.reltype.RelDataTypeFactoryImpl
copyType, createStructType, createStructType, createStructType, isJavaType, leastRestrictiveStructuredType
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.eigenbase.oj.OJTypeFactory
toType
 
Methods inherited from interface org.eigenbase.reltype.RelDataTypeFactory
copyType, createArrayType, createMultisetType, createSqlIntervalType, createStructType, createStructType, createStructType, createTypeWithCharsetAndCollation, createTypeWithNullability, leastRestrictive
 

Field Detail

DECIMAL_PRODUCT_SCALE_CAP

public static final int DECIMAL_PRODUCT_SCALE_CAP
Cap applied to the scale of a decimal multiplication product, if the product's ideal precision is too high to be supported by LucidDb.

See Also:
Constant Field Values

DECIMAL_QUOTIENT_SCALE_CAP

public static final int DECIMAL_QUOTIENT_SCALE_CAP
Cap applied to the scale of a decimal division quotient.

See Also:
Constant Field Values
Constructor Detail

LucidDbTypeFactory

public LucidDbTypeFactory(FarragoRepos repos)
Method Detail

createDecimalProduct

public RelDataType createDecimalProduct(RelDataType type1,
                                        RelDataType type2)
Similar to RelDataTypeFactoryImpl.createDecimalProduct(org.eigenbase.reltype.RelDataType, org.eigenbase.reltype.RelDataType) but caps the maximum scale at DECIMAL_PRODUCT_SCALE_CAP.

Specified by:
createDecimalProduct in interface RelDataTypeFactory
Overrides:
createDecimalProduct in class RelDataTypeFactoryImpl
Parameters:
type1 - type of the first operand
type2 - type of the second operand
Returns:
the result type for a decimal multiplication, or null if decimal multiplication should not be applied to the operands.

useDoubleMultiplication

public boolean useDoubleMultiplication(RelDataType type1,
                                       RelDataType type2)
Specified by:
useDoubleMultiplication in interface RelDataTypeFactory
Overrides:
useDoubleMultiplication in class RelDataTypeFactoryImpl
Returns:
whether a decimal multiplication should be implemented by casting arguments to double values.

createDecimalQuotient

public RelDataType createDecimalQuotient(RelDataType type1,
                                         RelDataType type2)
Similar to RelDataTypeFactoryImpl.createDecimalQuotient(org.eigenbase.reltype.RelDataType, org.eigenbase.reltype.RelDataType) but caps the maximum scale at DECIMAL_QUOTIENT_SCALE_CAP.

Specified by:
createDecimalQuotient in interface RelDataTypeFactory
Overrides:
createDecimalQuotient in class RelDataTypeFactoryImpl
Parameters:
type1 - type of the first operand
type2 - type of the second operand
Returns:
the result type for a decimal division, or null if decimal division should not be applied to the operands.

shouldRaggedFixedLengthValueUnionBeVariable

protected boolean shouldRaggedFixedLengthValueUnionBeVariable()
Description copied from class: SqlTypeFactoryImpl
Controls behavior discussed here.

Overrides:
shouldRaggedFixedLengthValueUnionBeVariable in class SqlTypeFactoryImpl
Returns:
false (the default) to provide strict SQL:2003 behavior; true to provide pragmatic behavior