OmniSciDB  06b3bd477c
 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 1737 of file MapDSqlOperatorTable.java.

Constructor & Destructor Documentation

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

Definition at line 1738 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().

1738  {
1739  super(name,
1740  SqlKind.OTHER_FUNCTION,
1741  null,
1742  null,
1743  OperandTypes.family(toSqlSignature(sig)),
1744  sig.isRowUdf() ? SqlFunctionCategory.SYSTEM
1745  : SqlFunctionCategory.USER_DEFINED_TABLE_FUNCTION);
1746  isRowUdf = sig.isRowUdf();
1747  if (isRowUdf) {
1748  ret = toSqlTypeName(sig.getRet());
1749  } else {
1750  ret = null;
1751  }
1752  }
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 1799 of file MapDSqlOperatorTable.java.

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

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

1800  {
1801  switch (type) {
1802  case PInt8:
1803  return ExtensionFunction.ExtArgumentType.Int8;
1804  case PInt16:
1805  return ExtensionFunction.ExtArgumentType.Int16;
1806  case PInt32:
1807  return ExtensionFunction.ExtArgumentType.Int32;
1808  case PInt64:
1809  return ExtensionFunction.ExtArgumentType.Int64;
1810  case PFloat:
1811  return ExtensionFunction.ExtArgumentType.Float;
1812  case PDouble:
1814  case PBool:
1815  return ExtensionFunction.ExtArgumentType.Bool;
1816  }
1817  MAPDLOGGER.error("getValueType: no value for type " + type);
1818  assert false;
1819  return null;
1820  }
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 1788 of file MapDSqlOperatorTable.java.

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

1788  {
1789  if (isRowUdf) {
1790  final RelDataTypeFactory typeFactory = opBinding.getTypeFactory();
1791  return typeFactory.createTypeWithNullability(
1792  typeFactory.createSqlType(ret), true);
1793  } else {
1794  assert opBinding.getOperandCount() == 2;
1795  return opBinding.getCursorOperand(0);
1796  }
1797  }
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 1777 of file MapDSqlOperatorTable.java.

References run_benchmark_import.type.

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

1777  {
1778  return type == ExtensionFunction.ExtArgumentType.PInt8
1779  || type == ExtensionFunction.ExtArgumentType.PInt16
1780  || type == ExtensionFunction.ExtArgumentType.PInt32
1781  || type == ExtensionFunction.ExtArgumentType.PInt64
1782  || type == ExtensionFunction.ExtArgumentType.PFloat
1783  || type == ExtensionFunction.ExtArgumentType.PDouble
1784  || type == ExtensionFunction.ExtArgumentType.PBool;
1785  }

+ 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 1754 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().

1755  {
1756  java.util.List<SqlTypeFamily> sql_sig = new java.util.ArrayList<SqlTypeFamily>();
1757  boolean isRowUdf = sig.isRowUdf();
1758  for (int arg_idx = 0; arg_idx < sig.getArgs().size(); ++arg_idx) {
1759  final ExtensionFunction.ExtArgumentType arg_type = sig.getArgs().get(arg_idx);
1760  if (isRowUdf) {
1761  sql_sig.add(toSqlTypeName(arg_type).getFamily());
1762  if (isPointerType(arg_type)) {
1763  ++arg_idx;
1764  }
1765  } else {
1766  if (isPointerType(arg_type)) {
1767  /* TODO: eliminate using getValueType */
1768  sql_sig.add(toSqlTypeName(getValueType(arg_type)).getFamily());
1769  } else {
1770  sql_sig.add(toSqlTypeName(arg_type).getFamily());
1771  }
1772  }
1773  }
1774  return sql_sig;
1775  }
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 1822 of file MapDSqlOperatorTable.java.

References ArrayBool, ArrayDouble, ArrayFloat, ArrayInt16, ArrayInt32, ArrayInt64, ArrayInt8, assert(), Bool, Cursor, Double, Int16, Int32, Int64, Int8, PBool, 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().

1823  {
1824  switch (type) {
1825  case Bool:
1826  return SqlTypeName.BOOLEAN;
1827  case Int8:
1828  return SqlTypeName.TINYINT;
1829  case Int16:
1830  return SqlTypeName.SMALLINT;
1831  case Int32:
1832  return SqlTypeName.INTEGER;
1833  case Int64:
1834  return SqlTypeName.BIGINT;
1835  case Float:
1836  return SqlTypeName.FLOAT;
1837  case Double:
1838  return SqlTypeName.DOUBLE;
1839  case PInt8:
1840  case PInt16:
1841  case PInt32:
1842  case PInt64:
1843  case PFloat:
1844  case PDouble:
1845  case PBool:
1846  case ArrayInt8:
1847  case ArrayInt16:
1848  case ArrayInt32:
1849  case ArrayInt64:
1850  case ArrayFloat:
1851  case ArrayDouble:
1852  case ArrayBool:
1853  return SqlTypeName.ARRAY;
1854  case GeoPoint:
1855  case GeoLineString:
1856  case GeoPolygon:
1857  case GeoMultiPolygon:
1858  return SqlTypeName.GEOMETRY;
1859  case Cursor:
1860  return SqlTypeName.CURSOR;
1861  }
1862  MAPDLOGGER.error("toSqlTypeName: unknown type " + type);
1863  assert false;
1864  return null;
1865  }
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: