OmniSciDB  4201147b46
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
com.mapd.calcite.parser.HeavyDBSqlOperatorTable.LeftRightPad Class Reference
+ Inheritance diagram for com.mapd.calcite.parser.HeavyDBSqlOperatorTable.LeftRightPad:
+ Collaboration diagram for com.mapd.calcite.parser.HeavyDBSqlOperatorTable.LeftRightPad:

Public Member Functions

 LeftRightPad (final String name)
 
SqlCall createCall (@Nullable SqlLiteral functionQualifier, SqlParserPos pos,@Nullable SqlNode...operands)
 
boolean checkOperandTypes (SqlCallBinding callBinding, boolean throwOnFailure)
 

Detailed Description

Definition at line 839 of file HeavyDBSqlOperatorTable.java.

Constructor & Destructor Documentation

com.mapd.calcite.parser.HeavyDBSqlOperatorTable.LeftRightPad.LeftRightPad ( final String  name)
inline

Definition at line 840 of file HeavyDBSqlOperatorTable.java.

840  {
841  super(name,
842  SqlKind.OTHER_FUNCTION,
843  ReturnTypes.ARG0.andThen(SqlTypeTransforms.TO_NULLABLE)
844  .andThen(SqlTypeTransforms.TO_VARYING),
845  null,
846  OperandTypes.and(OperandTypes.family(SqlTypeFamily.STRING,
847  SqlTypeFamily.INTEGER,
848  SqlTypeFamily.STRING),
849  new SameOperandTypeChecker(3) {
850  @Override
851  protected List<Integer> getOperandList(int operandCount) {
852  return ImmutableList.of(0, 2);
853  }
854  }),
855  SqlFunctionCategory.STRING);
856  }
string name
Definition: setup.in.py:72

Member Function Documentation

boolean com.mapd.calcite.parser.HeavyDBSqlOperatorTable.LeftRightPad.checkOperandTypes ( SqlCallBinding  callBinding,
boolean  throwOnFailure 
)
inline

Definition at line 882 of file HeavyDBSqlOperatorTable.java.

References TRIM.

882  {
883  if (!super.checkOperandTypes(callBinding, throwOnFailure)) {
884  return false;
885  }
886  switch (kind) {
887  case TRIM:
888  return SqlTypeUtil.isCharTypeComparable(callBinding,
889  ImmutableList.of(callBinding.operand(0), callBinding.operand(2)),
890  throwOnFailure);
891  default:
892  return true;
893  }
894  }
SqlCall com.mapd.calcite.parser.HeavyDBSqlOperatorTable.LeftRightPad.createCall ( @Nullable SqlLiteral  functionQualifier,
SqlParserPos  pos,
@Nullable SqlNode...  operands 
)
inline

Definition at line 859 of file HeavyDBSqlOperatorTable.java.

861  {
862  assert functionQualifier == null;
863  switch (operands.length) {
864  case 2:
865  operands = new SqlNode[] {
866  operands[0], operands[1], SqlLiteral.createCharString(" ", pos)};
867  break;
868  case 3:
869  if (operands[2] == null) {
870  operands[2] = SqlLiteral.createCharString(" ", pos);
871  }
872  operands = new SqlNode[] {operands[0], operands[1], operands[2]};
873  break;
874  default:
875  throw new IllegalArgumentException(
876  "Invalid operand count " + Arrays.toString(operands));
877  }
878  return super.createCall(functionQualifier, pos, operands);
879  }

The documentation for this class was generated from the following file: