OmniSciDB  a987f07e93
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
com.mapd.calcite.parser.HeavyDBSqlOperatorTable.RegexpReplace Class Reference
+ Inheritance diagram for com.mapd.calcite.parser.HeavyDBSqlOperatorTable.RegexpReplace:
+ Collaboration diagram for com.mapd.calcite.parser.HeavyDBSqlOperatorTable.RegexpReplace:

Public Member Functions

 RegexpReplace ()
 
SqlCall createCall (@Nullable SqlLiteral functionQualifier, SqlParserPos pos,@Nullable SqlNode...operands)
 
RelDataType inferReturnType (SqlOperatorBinding opBinding)
 

Static Private Member Functions

static java.util.List
< SqlTypeFamily > 
getSignatureFamilies ()
 

Detailed Description

Definition at line 1086 of file HeavyDBSqlOperatorTable.java.

Constructor & Destructor Documentation

com.mapd.calcite.parser.HeavyDBSqlOperatorTable.RegexpReplace.RegexpReplace ( )
inline

Definition at line 1087 of file HeavyDBSqlOperatorTable.java.

References heavydb.dtypes.STRING.

1087  {
1088  super("REGEXP_REPLACE",
1089  SqlKind.OTHER_FUNCTION,
1090  null,
1091  null,
1092  OperandTypes.family(getSignatureFamilies()),
1094  }
tuple STRING
Definition: dtypes.py:31

Member Function Documentation

SqlCall com.mapd.calcite.parser.HeavyDBSqlOperatorTable.RegexpReplace.createCall ( @Nullable SqlLiteral  functionQualifier,
SqlParserPos  pos,
@Nullable SqlNode...  operands 
)
inline

Definition at line 1109 of file HeavyDBSqlOperatorTable.java.

1111  {
1112  assert functionQualifier == null;
1113  final int num_operands = operands.length;
1114  if (num_operands < 2 || num_operands > 6) {
1115  throw new IllegalArgumentException(
1116  "Invalid operand count " + Arrays.toString(operands));
1117  }
1118  SqlNode[] new_operands = new SqlNode[6];
1119  // operand string
1120  new_operands[0] = operands[0];
1121  // pattern
1122  new_operands[1] = operands[1];
1123  // replacement
1124  if (num_operands < 3 || operands[2] == null) {
1125  new_operands[2] = SqlLiteral.createCharString("", pos);
1126  } else {
1127  new_operands[2] = operands[2];
1128  }
1129  // position
1130  if (num_operands < 4 || operands[3] == null) {
1131  new_operands[3] = SqlLiteral.createExactNumeric("1", pos);
1132  } else {
1133  new_operands[3] = operands[3];
1134  }
1135  // occurrence
1136  if (num_operands < 5 || operands[4] == null) {
1137  new_operands[4] = SqlLiteral.createExactNumeric("0", pos);
1138  } else {
1139  new_operands[4] = operands[4];
1140  }
1141  // parameters
1142  if (num_operands < 6 || operands[5] == null) {
1143  new_operands[5] = SqlLiteral.createCharString("c", pos);
1144  } else {
1145  new_operands[5] = operands[5];
1146  }
1147  return super.createCall(functionQualifier, pos, new_operands);
1148  }
static java.util.List<SqlTypeFamily> com.mapd.calcite.parser.HeavyDBSqlOperatorTable.RegexpReplace.getSignatureFamilies ( )
inlinestaticprivate

Definition at line 1096 of file HeavyDBSqlOperatorTable.java.

References heavydb.dtypes.STRING.

1096  {
1097  java.util.ArrayList<SqlTypeFamily> families =
1098  new java.util.ArrayList<SqlTypeFamily>();
1099  families.add(SqlTypeFamily.STRING);
1100  families.add(SqlTypeFamily.STRING);
1101  families.add(SqlTypeFamily.STRING);
1102  families.add(SqlTypeFamily.INTEGER);
1103  families.add(SqlTypeFamily.INTEGER);
1104  families.add(SqlTypeFamily.STRING);
1105  return families;
1106  }
tuple STRING
Definition: dtypes.py:31
RelDataType com.mapd.calcite.parser.HeavyDBSqlOperatorTable.RegexpReplace.inferReturnType ( SqlOperatorBinding  opBinding)
inline

Definition at line 1151 of file HeavyDBSqlOperatorTable.java.

1151  {
1152  return opBinding.getOperandType(0);
1153  }

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