OmniSciDB  29e35f4d58
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 1465 of file MapDSqlOperatorTable.java.

Constructor & Destructor Documentation

◆ ExtFunction()

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

Definition at line 1466 of file MapDSqlOperatorTable.java.

References com.mapd.parser.server.ExtensionFunction.getRet(), and com.mapd.parser.server.ExtensionFunction.isRowUdf.

1466  {
1467  super(name,
1468  SqlKind.OTHER_FUNCTION,
1469  null,
1470  null,
1471  OperandTypes.family(toSqlSignature(sig)),
1472  sig.isRowUdf() ? SqlFunctionCategory.SYSTEM
1473  : SqlFunctionCategory.USER_DEFINED_TABLE_FUNCTION);
1474  isRowUdf = sig.isRowUdf();
1475  if (isRowUdf) {
1476  ret = toSqlTypeName(sig.getRet());
1477  } else {
1478  ret = null;
1479  }
1480  }
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

◆ getValueType()

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

Definition at line 1526 of file MapDSqlOperatorTable.java.

References com.mapd.parser.server.ExtensionFunction.ExtArgumentType.Double, com.mapd.parser.server.ExtensionFunction.ExtArgumentType.Float, com.mapd.parser.server.ExtensionFunction.ExtArgumentType.Int16, com.mapd.parser.server.ExtensionFunction.ExtArgumentType.Int32, com.mapd.parser.server.ExtensionFunction.ExtArgumentType.Int64, com.mapd.parser.server.ExtensionFunction.ExtArgumentType.Int8, PDouble, PFloat, PInt16, PInt32, PInt64, PInt8, and run_benchmark_import.type.

1527  {
1528  switch (type) {
1529  case PInt8:
1530  return ExtensionFunction.ExtArgumentType.Int8;
1531  case PInt16:
1532  return ExtensionFunction.ExtArgumentType.Int16;
1533  case PInt32:
1534  return ExtensionFunction.ExtArgumentType.Int32;
1535  case PInt64:
1536  return ExtensionFunction.ExtArgumentType.Int64;
1537  case PFloat:
1538  return ExtensionFunction.ExtArgumentType.Float;
1539  case PDouble:
1540  return ExtensionFunction.ExtArgumentType.Double;
1541  }
1542  MAPDLOGGER.error("getValueType: no value for type " + type);
1543  assert false;
1544  return null;
1545  }

◆ inferReturnType()

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

Definition at line 1515 of file MapDSqlOperatorTable.java.

1515  {
1516  if (isRowUdf) {
1517  final RelDataTypeFactory typeFactory = opBinding.getTypeFactory();
1518  return typeFactory.createTypeWithNullability(
1519  typeFactory.createSqlType(ret), true);
1520  } else {
1521  assert opBinding.getOperandCount() == 2;
1522  return opBinding.getCursorOperand(0);
1523  }
1524  }

◆ isPointerType()

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

◆ toSqlSignature()

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

Definition at line 1482 of file MapDSqlOperatorTable.java.

References com.mapd.parser.server.ExtensionFunction.getArgs(), and com.mapd.parser.server.ExtensionFunction.isRowUdf.

1483  {
1484  java.util.List<SqlTypeFamily> sql_sig = new java.util.ArrayList<SqlTypeFamily>();
1485  boolean isRowUdf = sig.isRowUdf();
1486  for (int arg_idx = 0; arg_idx < sig.getArgs().size(); ++arg_idx) {
1487  final ExtensionFunction.ExtArgumentType arg_type = sig.getArgs().get(arg_idx);
1488  if (isRowUdf) {
1489  sql_sig.add(toSqlTypeName(arg_type).getFamily());
1490  if (isPointerType(arg_type)) {
1491  ++arg_idx;
1492  }
1493  } else {
1494  if (isPointerType(arg_type)) {
1495  /* TODO: eliminate using getValueType */
1496  sql_sig.add(toSqlTypeName(getValueType(arg_type)).getFamily());
1497  } else {
1498  sql_sig.add(toSqlTypeName(arg_type).getFamily());
1499  }
1500  }
1501  }
1502  return sql_sig;
1503  }
static boolean isPointerType(final ExtensionFunction.ExtArgumentType type)
const std::vector< ExtArgumentType > & getArgs() const
static SqlTypeName toSqlTypeName(final ExtensionFunction.ExtArgumentType type)
static ExtensionFunction.ExtArgumentType getValueType(final ExtensionFunction.ExtArgumentType type)
+ Here is the call graph for this function:

◆ toSqlTypeName()

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

Definition at line 1547 of file MapDSqlOperatorTable.java.

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

1548  {
1549  switch (type) {
1550  case Bool:
1551  return SqlTypeName.BOOLEAN;
1552  case Int8:
1553  return SqlTypeName.TINYINT;
1554  case Int16:
1555  return SqlTypeName.SMALLINT;
1556  case Int32:
1557  return SqlTypeName.INTEGER;
1558  case Int64:
1559  return SqlTypeName.BIGINT;
1560  case Float:
1561  return SqlTypeName.FLOAT;
1562  case Double:
1563  return SqlTypeName.DOUBLE;
1564  case PInt8:
1565  case PInt16:
1566  case PInt32:
1567  case PInt64:
1568  case PFloat:
1569  case PDouble:
1570  case ArrayInt8:
1571  case ArrayInt16:
1572  case ArrayInt32:
1573  case ArrayInt64:
1574  case ArrayFloat:
1575  case ArrayDouble:
1576  return SqlTypeName.ARRAY;
1577  case GeoPoint:
1578  case GeoLineString:
1579  case GeoPolygon:
1580  return SqlTypeName.GEOMETRY;
1581  case Cursor:
1582  return SqlTypeName.CURSOR;
1583  }
1584  MAPDLOGGER.error("toSqlTypeName: unknown type " + type);
1585  assert false;
1586  return null;
1587  }

Member Data Documentation

◆ isRowUdf

final boolean com.mapd.calcite.parser.MapDSqlOperatorTable.ExtFunction.isRowUdf
private

Definition at line 1588 of file MapDSqlOperatorTable.java.

◆ ret

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

Definition at line 1589 of file MapDSqlOperatorTable.java.


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