OmniSciDB  a5dc49c757
 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 1099 of file HeavyDBSqlOperatorTable.java.

Constructor & Destructor Documentation

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

Definition at line 1100 of file HeavyDBSqlOperatorTable.java.

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

References TRIM.

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

Definition at line 1119 of file HeavyDBSqlOperatorTable.java.

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

Definition at line 1157 of file HeavyDBSqlOperatorTable.java.

1157  {
1158  // if there are only 2 Operands, the code will be creating 'defaults'
1159  return (operands.size() == 2);
1160  }

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