OmniSciDB  f17484ade4
 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)
 
boolean requiresCreate (List< SqlNode > operands)
 

Detailed Description

Definition at line 1092 of file HeavyDBSqlOperatorTable.java.

Constructor & Destructor Documentation

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

Definition at line 1093 of file HeavyDBSqlOperatorTable.java.

1093  {
1094  super(name,
1095  SqlKind.OTHER_FUNCTION,
1096  ReturnTypes.ARG0.andThen(SqlTypeTransforms.TO_NULLABLE)
1097  .andThen(SqlTypeTransforms.TO_VARYING),
1098  null,
1099  OperandTypes.and(OperandTypes.family(SqlTypeFamily.STRING,
1100  SqlTypeFamily.INTEGER,
1101  SqlTypeFamily.STRING),
1102  new SameOperandTypeChecker(3) {
1103  @Override
1104  protected List<Integer> getOperandList(int operandCount) {
1105  return ImmutableList.of(0, 2);
1106  }
1107  }),
1108  SqlFunctionCategory.STRING);
1109  }
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 1135 of file HeavyDBSqlOperatorTable.java.

References TRIM.

1135  {
1136  if (!super.checkOperandTypes(callBinding, throwOnFailure)) {
1137  return false;
1138  }
1139  switch (kind) {
1140  case TRIM:
1141  return SqlTypeUtil.isCharTypeComparable(callBinding,
1142  ImmutableList.of(callBinding.operand(0), callBinding.operand(2)),
1143  throwOnFailure);
1144  default:
1145  return true;
1146  }
1147  }
SqlCall com.mapd.calcite.parser.HeavyDBSqlOperatorTable.LeftRightPad.createCall ( @Nullable SqlLiteral  functionQualifier,
SqlParserPos  pos,
@Nullable SqlNode...  operands 
)
inline

Definition at line 1112 of file HeavyDBSqlOperatorTable.java.

1114  {
1115  assert functionQualifier == null;
1116  switch (operands.length) {
1117  case 2:
1118  operands = new SqlNode[] {
1119  operands[0], operands[1], SqlLiteral.createCharString(" ", pos)};
1120  break;
1121  case 3:
1122  if (operands[2] == null) {
1123  operands[2] = SqlLiteral.createCharString(" ", pos);
1124  }
1125  operands = new SqlNode[] {operands[0], operands[1], operands[2]};
1126  break;
1127  default:
1128  throw new IllegalArgumentException(
1129  "Invalid operand count " + Arrays.toString(operands));
1130  }
1131  return super.createCall(functionQualifier, pos, operands);
1132  }
boolean com.mapd.calcite.parser.HeavyDBSqlOperatorTable.LeftRightPad.requiresCreate ( List< SqlNode >  operands)
inline

Definition at line 1150 of file HeavyDBSqlOperatorTable.java.

1150  {
1151  // if there are only 2 Operands, the code will be creating 'defaults'
1152  return (operands.size() == 2);
1153  }

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