OmniSciDB  72c90bc290
 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 1094 of file HeavyDBSqlOperatorTable.java.

Constructor & Destructor Documentation

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

Definition at line 1095 of file HeavyDBSqlOperatorTable.java.

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

References TRIM.

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

Definition at line 1114 of file HeavyDBSqlOperatorTable.java.

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

Definition at line 1152 of file HeavyDBSqlOperatorTable.java.

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

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