OmniSciDB  a987f07e93
 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 1156 of file HeavyDBSqlOperatorTable.java.

Constructor & Destructor Documentation

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

Definition at line 1157 of file HeavyDBSqlOperatorTable.java.

References heavydb.dtypes.STRING.

1157  {
1158  super("REGEXP_SUBSTR",
1159  SqlKind.OTHER_FUNCTION,
1160  null,
1161  null,
1162  OperandTypes.family(getSignatureFamilies()),
1164  }
tuple STRING
Definition: dtypes.py:31
com.mapd.calcite.parser.HeavyDBSqlOperatorTable.RegexpSubstr.RegexpSubstr ( final String  alias)
inline

Definition at line 1166 of file HeavyDBSqlOperatorTable.java.

1166  {
1167  super(alias,
1168  SqlKind.OTHER_FUNCTION,
1169  null,
1170  null,
1171  OperandTypes.family(getSignatureFamilies()),
1172  SqlFunctionCategory.SYSTEM);
1173  }

Member Function Documentation

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

Definition at line 1188 of file HeavyDBSqlOperatorTable.java.

1190  {
1191  assert functionQualifier == null;
1192  final int num_operands = operands.length;
1193  if (num_operands < 2 || num_operands > 6) {
1194  throw new IllegalArgumentException(
1195  "Invalid operand count " + Arrays.toString(operands));
1196  }
1197  SqlNode[] new_operands = new SqlNode[6];
1198 
1199  // operand string (required)
1200  new_operands[0] = operands[0];
1201  // pattern (required)
1202  new_operands[1] = operands[1];
1203  // start position
1204  if (num_operands < 3 || operands[2] == null) {
1205  new_operands[2] = SqlLiteral.createExactNumeric("1", pos);
1206  } else {
1207  new_operands[2] = operands[2];
1208  }
1209  // match occurrence
1210  if (num_operands < 4 || operands[3] == null) {
1211  new_operands[3] = SqlLiteral.createExactNumeric("1", pos);
1212  } else {
1213  new_operands[3] = operands[3];
1214  }
1215  // regex params (default 'c' = case sensitive)
1216  if (num_operands < 5 || operands[4] == null) {
1217  new_operands[4] = SqlLiteral.createCharString("c", pos);
1218  } else {
1219  new_operands[4] = operands[4];
1220  }
1221  // Sub-match occurrence, valid with regex param 'e'
1222  if (num_operands < 6 || operands[5] == null) {
1223  new_operands[5] = SqlLiteral.createExactNumeric("1", pos);
1224  } else {
1225  new_operands[5] = operands[5];
1226  }
1227  return super.createCall(functionQualifier, pos, new_operands);
1228  }
static java.util.List<SqlTypeFamily> com.mapd.calcite.parser.HeavyDBSqlOperatorTable.RegexpSubstr.getSignatureFamilies ( )
inlinestaticprivate

Definition at line 1175 of file HeavyDBSqlOperatorTable.java.

References heavydb.dtypes.STRING.

1175  {
1176  java.util.ArrayList<SqlTypeFamily> families =
1177  new java.util.ArrayList<SqlTypeFamily>();
1178  families.add(SqlTypeFamily.STRING);
1179  families.add(SqlTypeFamily.STRING);
1180  families.add(SqlTypeFamily.INTEGER);
1181  families.add(SqlTypeFamily.INTEGER);
1182  families.add(SqlTypeFamily.STRING);
1183  families.add(SqlTypeFamily.INTEGER);
1184  return families;
1185  }
tuple STRING
Definition: dtypes.py:31
RelDataType com.mapd.calcite.parser.HeavyDBSqlOperatorTable.RegexpSubstr.inferReturnType ( SqlOperatorBinding  opBinding)
inline

Definition at line 1231 of file HeavyDBSqlOperatorTable.java.

1231  {
1232  return opBinding.getOperandType(0);
1233  }

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