Class CompositeOperandTypeChecker

java.lang.Object
org.apache.calcite.sql.type.CompositeOperandTypeChecker
All Implemented Interfaces:
SqlOperandTypeChecker
Direct Known Subclasses:
CompositeSingleOperandTypeChecker

public class CompositeOperandTypeChecker extends Object implements SqlOperandTypeChecker
This class allows multiple existing SqlOperandTypeChecker rules to be combined into one rule. For example, allowing an operand to be either string or numeric could be done by:

 CompositeOperandTypeChecker newCompositeRule =
     new CompositeOperandTypeChecker(Composition.OR,
         new SqlOperandTypeChecker[]{stringRule, numericRule});
 

Similarly a rule that would only allow a numeric literal can be done by:


 CompositeOperandTypeChecker newCompositeRule =
     new CompositeOperandTypeChecker(Composition.AND,
         new SqlOperandTypeChecker[]{numericRule, literalRule});
 

Finally, creating a signature expecting a string for the first operand and a numeric for the second operand can be done by:


 CompositeOperandTypeChecker newCompositeRule =
     new CompositeOperandTypeChecker(Composition.SEQUENCE,
         new SqlOperandTypeChecker[]{stringRule, numericRule});
 

For SEQUENCE composition, the rules must be instances of SqlSingleOperandTypeChecker, and signature generation is not supported. For AND composition, only the first rule is used for signature generation.