OmniSciDB  c1a53651b2
 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 904 of file HeavyDBSqlOperatorTable.java.

Constructor & Destructor Documentation

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

Definition at line 905 of file HeavyDBSqlOperatorTable.java.

905  {
906  super(name,
907  SqlKind.OTHER_FUNCTION,
908  ReturnTypes.ARG0.andThen(SqlTypeTransforms.TO_NULLABLE)
909  .andThen(SqlTypeTransforms.TO_VARYING),
910  null,
911  OperandTypes.and(OperandTypes.family(SqlTypeFamily.STRING,
912  SqlTypeFamily.INTEGER,
913  SqlTypeFamily.STRING),
914  new SameOperandTypeChecker(3) {
915  @Override
916  protected List<Integer> getOperandList(int operandCount) {
917  return ImmutableList.of(0, 2);
918  }
919  }),
920  SqlFunctionCategory.STRING);
921  }
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 947 of file HeavyDBSqlOperatorTable.java.

References TRIM.

947  {
948  if (!super.checkOperandTypes(callBinding, throwOnFailure)) {
949  return false;
950  }
951  switch (kind) {
952  case TRIM:
953  return SqlTypeUtil.isCharTypeComparable(callBinding,
954  ImmutableList.of(callBinding.operand(0), callBinding.operand(2)),
955  throwOnFailure);
956  default:
957  return true;
958  }
959  }
SqlCall com.mapd.calcite.parser.HeavyDBSqlOperatorTable.LeftRightPad.createCall ( @Nullable SqlLiteral  functionQualifier,
SqlParserPos  pos,
@Nullable SqlNode...  operands 
)
inline

Definition at line 924 of file HeavyDBSqlOperatorTable.java.

926  {
927  assert functionQualifier == null;
928  switch (operands.length) {
929  case 2:
930  operands = new SqlNode[] {
931  operands[0], operands[1], SqlLiteral.createCharString(" ", pos)};
932  break;
933  case 3:
934  if (operands[2] == null) {
935  operands[2] = SqlLiteral.createCharString(" ", pos);
936  }
937  operands = new SqlNode[] {operands[0], operands[1], operands[2]};
938  break;
939  default:
940  throw new IllegalArgumentException(
941  "Invalid operand count " + Arrays.toString(operands));
942  }
943  return super.createCall(functionQualifier, pos, operands);
944  }
boolean com.mapd.calcite.parser.HeavyDBSqlOperatorTable.LeftRightPad.requiresCreate ( List< SqlNode >  operands)
inline

Definition at line 962 of file HeavyDBSqlOperatorTable.java.

962  {
963  // if there are only 2 Operands, the code will be creating 'defaults'
964  return (operands.size() == 2);
965  }

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