OmniSciDB  1dac507f6e
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
com.mapd.calcite.parser.MapDSqlOperatorTable.ExtFunction Class Reference
+ Inheritance diagram for com.mapd.calcite.parser.MapDSqlOperatorTable.ExtFunction:
+ Collaboration diagram for com.mapd.calcite.parser.MapDSqlOperatorTable.ExtFunction:

Public Member Functions

RelDataType inferReturnType (SqlOperatorBinding opBinding)
 

Package Functions

 ExtFunction (final String name, final ExtensionFunction sig)
 

Static Private Member Functions

static java.util.List
< SqlTypeFamily > 
toSqlSignature (final ExtensionFunction sig)
 
static boolean isPointerType (final ExtensionFunction.ExtArgumentType type)
 
static
ExtensionFunction.ExtArgumentType 
getValueType (final ExtensionFunction.ExtArgumentType type)
 
static SqlTypeName toSqlTypeName (final ExtensionFunction.ExtArgumentType type)
 

Private Attributes

final boolean isRowUdf
 
final SqlTypeName ret
 

Detailed Description

Definition at line 1436 of file MapDSqlOperatorTable.java.

Constructor & Destructor Documentation

com.mapd.calcite.parser.MapDSqlOperatorTable.ExtFunction.ExtFunction ( final String  name,
final ExtensionFunction  sig 
)
inlinepackage

Definition at line 1437 of file MapDSqlOperatorTable.java.

References com.mapd.parser.server.ExtensionFunction.getRet(), com.mapd.calcite.parser.MapDSqlOperatorTable.ExtFunction.isRowUdf, com.mapd.calcite.parser.MapDSqlOperatorTable.ExtFunction.ret, com.mapd.calcite.parser.MapDSqlOperatorTable.ExtFunction.toSqlSignature(), and com.mapd.calcite.parser.MapDSqlOperatorTable.ExtFunction.toSqlTypeName().

1437  {
1438  super(name,
1439  SqlKind.OTHER_FUNCTION,
1440  null,
1441  null,
1442  OperandTypes.family(toSqlSignature(sig)),
1443  sig.isRowUdf() ? SqlFunctionCategory.SYSTEM
1444  : SqlFunctionCategory.USER_DEFINED_TABLE_FUNCTION);
1445  isRowUdf = sig.isRowUdf();
1446  if (isRowUdf) {
1447  ret = toSqlTypeName(sig.getRet());
1448  } else {
1449  ret = null;
1450  }
1451  }
static SqlTypeName toSqlTypeName(final ExtensionFunction.ExtArgumentType type)
static java.util.List< SqlTypeFamily > toSqlSignature(final ExtensionFunction sig)

+ Here is the call graph for this function:

Member Function Documentation

static ExtensionFunction.ExtArgumentType com.mapd.calcite.parser.MapDSqlOperatorTable.ExtFunction.getValueType ( final ExtensionFunction.ExtArgumentType  type)
inlinestaticprivate

Definition at line 1497 of file MapDSqlOperatorTable.java.

References assert(), PDouble, PFloat, PInt16, PInt32, PInt64, PInt8, and run_benchmark_import.type.

Referenced by com.mapd.calcite.parser.MapDSqlOperatorTable.ExtFunction.toSqlSignature().

1498  {
1499  switch (type) {
1500  case PInt8:
1501  return ExtensionFunction.ExtArgumentType.Int8;
1502  case PInt16:
1503  return ExtensionFunction.ExtArgumentType.Int16;
1504  case PInt32:
1505  return ExtensionFunction.ExtArgumentType.Int32;
1506  case PInt64:
1507  return ExtensionFunction.ExtArgumentType.Int64;
1508  case PFloat:
1509  return ExtensionFunction.ExtArgumentType.Float;
1510  case PDouble:
1511  return ExtensionFunction.ExtArgumentType.Double;
1512  }
1513  MAPDLOGGER.error("getValueType: no value for type " + type);
1514  assert false;
1515  return null;
1516  }
int64_t const int32_t sz assert(dest)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

RelDataType com.mapd.calcite.parser.MapDSqlOperatorTable.ExtFunction.inferReturnType ( SqlOperatorBinding  opBinding)
inline

Definition at line 1486 of file MapDSqlOperatorTable.java.

References assert(), com.mapd.calcite.parser.MapDSqlOperatorTable.ExtFunction.isRowUdf, and com.mapd.calcite.parser.MapDSqlOperatorTable.ExtFunction.ret.

1486  {
1487  if (isRowUdf) {
1488  final RelDataTypeFactory typeFactory = opBinding.getTypeFactory();
1489  return typeFactory.createTypeWithNullability(
1490  typeFactory.createSqlType(ret), true);
1491  } else {
1492  assert opBinding.getOperandCount() == 2;
1493  return opBinding.getCursorOperand(0);
1494  }
1495  }
int64_t const int32_t sz assert(dest)

+ Here is the call graph for this function:

static boolean com.mapd.calcite.parser.MapDSqlOperatorTable.ExtFunction.isPointerType ( final ExtensionFunction.ExtArgumentType  type)
inlinestaticprivate

Definition at line 1476 of file MapDSqlOperatorTable.java.

References run_benchmark_import.type.

Referenced by com.mapd.calcite.parser.MapDSqlOperatorTable.ExtFunction.toSqlSignature().

1476  {
1477  return type == ExtensionFunction.ExtArgumentType.PInt8
1478  || type == ExtensionFunction.ExtArgumentType.PInt16
1479  || type == ExtensionFunction.ExtArgumentType.PInt32
1480  || type == ExtensionFunction.ExtArgumentType.PInt64
1481  || type == ExtensionFunction.ExtArgumentType.PFloat
1482  || type == ExtensionFunction.ExtArgumentType.PDouble;
1483  }

+ Here is the caller graph for this function:

static java.util.List<SqlTypeFamily> com.mapd.calcite.parser.MapDSqlOperatorTable.ExtFunction.toSqlSignature ( final ExtensionFunction  sig)
inlinestaticprivate

Definition at line 1453 of file MapDSqlOperatorTable.java.

References com.mapd.calcite.parser.MapDSqlOperatorTable.ExtFunction.getValueType(), com.mapd.calcite.parser.MapDSqlOperatorTable.ExtFunction.isPointerType(), com.mapd.calcite.parser.MapDSqlOperatorTable.ExtFunction.isRowUdf, and com.mapd.calcite.parser.MapDSqlOperatorTable.ExtFunction.toSqlTypeName().

Referenced by com.mapd.calcite.parser.MapDSqlOperatorTable.ExtFunction.ExtFunction().

1454  {
1455  java.util.List<SqlTypeFamily> sql_sig = new java.util.ArrayList<SqlTypeFamily>();
1456  boolean isRowUdf = sig.isRowUdf();
1457  for (int arg_idx = 0; arg_idx < sig.getArgs().size(); ++arg_idx) {
1458  final ExtensionFunction.ExtArgumentType arg_type = sig.getArgs().get(arg_idx);
1459  if (isRowUdf) {
1460  sql_sig.add(toSqlTypeName(arg_type).getFamily());
1461  if (isPointerType(arg_type)) {
1462  ++arg_idx;
1463  }
1464  } else {
1465  if (isPointerType(arg_type)) {
1466  /* TODO: eliminate using getValueType */
1467  sql_sig.add(toSqlTypeName(getValueType(arg_type)).getFamily());
1468  } else {
1469  sql_sig.add(toSqlTypeName(arg_type).getFamily());
1470  }
1471  }
1472  }
1473  return sql_sig;
1474  }
static boolean isPointerType(final ExtensionFunction.ExtArgumentType type)
static SqlTypeName toSqlTypeName(final ExtensionFunction.ExtArgumentType type)
static ExtensionFunction.ExtArgumentType getValueType(final ExtensionFunction.ExtArgumentType type)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static SqlTypeName com.mapd.calcite.parser.MapDSqlOperatorTable.ExtFunction.toSqlTypeName ( final ExtensionFunction.ExtArgumentType  type)
inlinestaticprivate

Definition at line 1518 of file MapDSqlOperatorTable.java.

References ArrayDouble, ArrayFloat, ArrayInt16, ArrayInt32, ArrayInt64, ArrayInt8, assert(), Bool, Cursor, Double, Float, GeoLineString, GeoPoint, GeoPolygon, Int16, Int32, Int64, Int8, PDouble, PFloat, PInt16, PInt32, PInt64, PInt8, and run_benchmark_import.type.

Referenced by com.mapd.calcite.parser.MapDSqlOperatorTable.ExtFunction.ExtFunction(), and com.mapd.calcite.parser.MapDSqlOperatorTable.ExtFunction.toSqlSignature().

1519  {
1520  switch (type) {
1521  case Bool:
1522  return SqlTypeName.BOOLEAN;
1523  case Int8:
1524  return SqlTypeName.TINYINT;
1525  case Int16:
1526  return SqlTypeName.SMALLINT;
1527  case Int32:
1528  return SqlTypeName.INTEGER;
1529  case Int64:
1530  return SqlTypeName.BIGINT;
1531  case Float:
1532  return SqlTypeName.FLOAT;
1533  case Double:
1534  return SqlTypeName.DOUBLE;
1535  case PInt8:
1536  case PInt16:
1537  case PInt32:
1538  case PInt64:
1539  case PFloat:
1540  case PDouble:
1541  case ArrayInt8:
1542  case ArrayInt16:
1543  case ArrayInt32:
1544  case ArrayInt64:
1545  case ArrayFloat:
1546  case ArrayDouble:
1547  return SqlTypeName.ARRAY;
1548  case GeoPoint:
1549  case GeoLineString:
1550  case GeoPolygon:
1551  return SqlTypeName.GEOMETRY;
1552  case Cursor:
1553  return SqlTypeName.CURSOR;
1554  }
1555  MAPDLOGGER.error("toSqlTypeName: unknown type " + type);
1556  assert false;
1557  return null;
1558  }
int64_t const int32_t sz assert(dest)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Member Data Documentation

final SqlTypeName com.mapd.calcite.parser.MapDSqlOperatorTable.ExtFunction.ret
private

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