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

Public Member Functions

 RegexpSubstr ()
 
 RegexpSubstr (final String alias)
 
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 1095 of file HeavyDBSqlOperatorTable.java.

Constructor & Destructor Documentation

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

Definition at line 1096 of file HeavyDBSqlOperatorTable.java.

References heavydb.dtypes.STRING.

1096  {
1097  super("REGEXP_SUBSTR",
1098  SqlKind.OTHER_FUNCTION,
1099  null,
1100  null,
1101  OperandTypes.family(getSignatureFamilies()),
1103  }
tuple STRING
Definition: dtypes.py:31
com.mapd.calcite.parser.HeavyDBSqlOperatorTable.RegexpSubstr.RegexpSubstr ( final String  alias)
inline

Definition at line 1105 of file HeavyDBSqlOperatorTable.java.

1105  {
1106  super(alias,
1107  SqlKind.OTHER_FUNCTION,
1108  null,
1109  null,
1110  OperandTypes.family(getSignatureFamilies()),
1111  SqlFunctionCategory.SYSTEM);
1112  }

Member Function Documentation

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

Definition at line 1127 of file HeavyDBSqlOperatorTable.java.

1129  {
1130  assert functionQualifier == null;
1131  final int num_operands = operands.length;
1132  if (num_operands < 2 || num_operands > 6) {
1133  throw new IllegalArgumentException(
1134  "Invalid operand count " + Arrays.toString(operands));
1135  }
1136  SqlNode[] new_operands = new SqlNode[6];
1137 
1138  // operand string (required)
1139  new_operands[0] = operands[0];
1140  // pattern (required)
1141  new_operands[1] = operands[1];
1142  // start position
1143  if (num_operands < 3 || operands[2] == null) {
1144  new_operands[2] = SqlLiteral.createExactNumeric("1", pos);
1145  } else {
1146  new_operands[2] = operands[2];
1147  }
1148  // match occurrence
1149  if (num_operands < 4 || operands[3] == null) {
1150  new_operands[3] = SqlLiteral.createExactNumeric("1", pos);
1151  } else {
1152  new_operands[3] = operands[3];
1153  }
1154  // regex params (default 'c' = case sensitive)
1155  if (num_operands < 5 || operands[4] == null) {
1156  new_operands[4] = SqlLiteral.createCharString("c", pos);
1157  } else {
1158  new_operands[4] = operands[4];
1159  }
1160  // Sub-match occurrence, valid with regex param 'e'
1161  if (num_operands < 6 || operands[5] == null) {
1162  new_operands[5] = SqlLiteral.createExactNumeric("1", pos);
1163  } else {
1164  new_operands[5] = operands[5];
1165  }
1166  return super.createCall(functionQualifier, pos, new_operands);
1167  }
static java.util.List<SqlTypeFamily> com.mapd.calcite.parser.HeavyDBSqlOperatorTable.RegexpSubstr.getSignatureFamilies ( )
inlinestaticprivate

Definition at line 1114 of file HeavyDBSqlOperatorTable.java.

References heavydb.dtypes.STRING.

1114  {
1115  java.util.ArrayList<SqlTypeFamily> families =
1116  new java.util.ArrayList<SqlTypeFamily>();
1117  families.add(SqlTypeFamily.STRING);
1118  families.add(SqlTypeFamily.STRING);
1119  families.add(SqlTypeFamily.INTEGER);
1120  families.add(SqlTypeFamily.INTEGER);
1121  families.add(SqlTypeFamily.STRING);
1122  families.add(SqlTypeFamily.INTEGER);
1123  return families;
1124  }
tuple STRING
Definition: dtypes.py:31
RelDataType com.mapd.calcite.parser.HeavyDBSqlOperatorTable.RegexpSubstr.inferReturnType ( SqlOperatorBinding  opBinding)
inline

Definition at line 1170 of file HeavyDBSqlOperatorTable.java.

1170  {
1171  return opBinding.getOperandType(0);
1172  }

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