OmniSciDB  b28c0d5765
 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 890 of file HeavyDBSqlOperatorTable.java.

Constructor & Destructor Documentation

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

Definition at line 891 of file HeavyDBSqlOperatorTable.java.

891  {
892  super(name,
893  SqlKind.OTHER_FUNCTION,
894  ReturnTypes.ARG0.andThen(SqlTypeTransforms.TO_NULLABLE)
895  .andThen(SqlTypeTransforms.TO_VARYING),
896  null,
897  OperandTypes.and(OperandTypes.family(SqlTypeFamily.STRING,
898  SqlTypeFamily.INTEGER,
899  SqlTypeFamily.STRING),
900  new SameOperandTypeChecker(3) {
901  @Override
902  protected List<Integer> getOperandList(int operandCount) {
903  return ImmutableList.of(0, 2);
904  }
905  }),
906  SqlFunctionCategory.STRING);
907  }
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 933 of file HeavyDBSqlOperatorTable.java.

References TRIM.

933  {
934  if (!super.checkOperandTypes(callBinding, throwOnFailure)) {
935  return false;
936  }
937  switch (kind) {
938  case TRIM:
939  return SqlTypeUtil.isCharTypeComparable(callBinding,
940  ImmutableList.of(callBinding.operand(0), callBinding.operand(2)),
941  throwOnFailure);
942  default:
943  return true;
944  }
945  }
SqlCall com.mapd.calcite.parser.HeavyDBSqlOperatorTable.LeftRightPad.createCall ( @Nullable SqlLiteral  functionQualifier,
SqlParserPos  pos,
@Nullable SqlNode...  operands 
)
inline

Definition at line 910 of file HeavyDBSqlOperatorTable.java.

912  {
913  assert functionQualifier == null;
914  switch (operands.length) {
915  case 2:
916  operands = new SqlNode[] {
917  operands[0], operands[1], SqlLiteral.createCharString(" ", pos)};
918  break;
919  case 3:
920  if (operands[2] == null) {
921  operands[2] = SqlLiteral.createCharString(" ", pos);
922  }
923  operands = new SqlNode[] {operands[0], operands[1], operands[2]};
924  break;
925  default:
926  throw new IllegalArgumentException(
927  "Invalid operand count " + Arrays.toString(operands));
928  }
929  return super.createCall(functionQualifier, pos, operands);
930  }
boolean com.mapd.calcite.parser.HeavyDBSqlOperatorTable.LeftRightPad.requiresCreate ( List< SqlNode >  operands)
inline

Definition at line 948 of file HeavyDBSqlOperatorTable.java.

948  {
949  // if there are only 2 Operands, the code will be creating 'defaults'
950  return (operands.size() == 2);
951  }

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