OmniSciDB  a987f07e93
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
com.mapd.parser.server.ExtensionFunction Class Reference
+ Collaboration diagram for com.mapd.parser.server.ExtensionFunction:

Classes

enum  ExtArgumentType
 

Public Member Functions

Map< String, List
< ExtArgumentType > > 
getCursorFieldTypes ()
 
List< ExtArgumentTypegetArgs ()
 
List< ExtArgumentTypegetOuts ()
 
List< String > getArgNames ()
 
List< String > getPrettyArgNames ()
 
List< String > getOutNames ()
 
ExtArgumentType getRet ()
 
SqlTypeName getSqlRet ()
 
Map< String, String > getOptions ()
 
boolean isRowUdf ()
 
boolean isTableUdf ()
 
String toJson (final String name)
 
final java.util.List
< SqlTypeFamily > 
toSqlSignature ()
 

Static Public Member Functions

static boolean isPointerType (final ExtArgumentType type)
 
static boolean isColumnArrayType (final ExtArgumentType type)
 
static boolean isArrayType (final ExtArgumentType type)
 
static boolean isColumnListArrayType (final ExtArgumentType type)
 
static boolean isColumnType (final ExtArgumentType type)
 
static boolean isColumnListType (final ExtArgumentType type)
 
static ExtArgumentType getValueType (final ExtArgumentType type)
 
static ExtArgumentType toSqlTypeName (final String type)
 
static SqlTypeName toSqlTypeName (final ExtArgumentType type)
 

Package Functions

 ExtensionFunction (final List< ExtArgumentType > args, final ExtArgumentType ret, final List< Map< String, String >> annotations)
 
 ExtensionFunction (final List< ExtArgumentType > args, final List< ExtArgumentType > outs, final List< String > names, final Map< String, String > options, final Map< String, List< ExtArgumentType >> cursor_field_types)
 

Static Package Attributes

static final Logger HEAVYDBLOGGER = LoggerFactory.getLogger(ExtensionFunction.class)
 

Static Private Member Functions

static String typeName (final ExtArgumentType type)
 
static String dq (final String str)
 

Private Attributes

final List< ExtArgumentTypeargs
 
final List< ExtArgumentTypeouts
 
final List< String > names
 
final ExtArgumentType ret
 
final boolean isRowUdf
 
final List< Map< String, String > > annotations
 
final Map< String, String > options
 
final Map< String, List
< ExtArgumentType > > 
cursor_field_types
 

Detailed Description

Definition at line 31 of file ExtensionFunction.java.

Constructor & Destructor Documentation

com.mapd.parser.server.ExtensionFunction.ExtensionFunction ( final List< ExtArgumentType args,
final ExtArgumentType  ret,
final List< Map< String, String >>  annotations 
)
inlinepackage

Definition at line 106 of file ExtensionFunction.java.

References com.mapd.parser.server.ExtensionFunction.annotations, com.mapd.parser.server.ExtensionFunction.args, and com.mapd.parser.server.ExtensionFunction.ret.

108  {
109  this.args = args;
110  this.ret = ret;
111  this.annotations = annotations;
112  this.outs = null;
113  this.names = null;
114  this.isRowUdf = true;
115  this.options = null;
116  this.cursor_field_types = null;
117  }
final List< Map< String, String > > annotations
com.mapd.parser.server.ExtensionFunction.ExtensionFunction ( final List< ExtArgumentType args,
final List< ExtArgumentType outs,
final List< String >  names,
final Map< String, String >  options,
final Map< String, List< ExtArgumentType >>  cursor_field_types 
)
inlinepackage

Definition at line 119 of file ExtensionFunction.java.

References com.mapd.parser.server.ExtensionFunction.args, com.mapd.parser.server.ExtensionFunction.cursor_field_types, com.mapd.parser.server.ExtensionFunction.names, com.mapd.parser.server.ExtensionFunction.options, and com.mapd.parser.server.ExtensionFunction.outs.

123  {
124  this.args = args;
125  this.ret = null;
126  this.outs = outs;
127  this.names = names;
128  this.isRowUdf = false;
129  this.annotations = null;
130  this.options = options;
131  this.cursor_field_types = cursor_field_types;
132  }
final Map< String, List< ExtArgumentType > > cursor_field_types

Member Function Documentation

static String com.mapd.parser.server.ExtensionFunction.dq ( final String  str)
inlinestaticprivate

Definition at line 381 of file ExtensionFunction.java.

Referenced by com.mapd.parser.server.ExtensionFunction.toJson().

381  {
382  return "\"" + str + "\"";
383  }

+ Here is the caller graph for this function:

List<String> com.mapd.parser.server.ExtensionFunction.getArgNames ( )
inline

Definition at line 147 of file ExtensionFunction.java.

References com.mapd.parser.server.ExtensionFunction.names.

147  {
148  if (this.names != null) {
149  return this.names.subList(0, this.args.size());
150  }
151  return null;
152  }
List<ExtArgumentType> com.mapd.parser.server.ExtensionFunction.getArgs ( )
inline

Definition at line 139 of file ExtensionFunction.java.

References run_benchmark_import.args.

139  {
140  return this.args;
141  }
Map<String, List<ExtArgumentType> > com.mapd.parser.server.ExtensionFunction.getCursorFieldTypes ( )
inline

Definition at line 134 of file ExtensionFunction.java.

References com.mapd.parser.server.ExtensionFunction.isTableUdf().

134  {
135  assert (this.isTableUdf());
136  return this.cursor_field_types;
137  }

+ Here is the call graph for this function:

Map<String, String> com.mapd.parser.server.ExtensionFunction.getOptions ( )
inline

Definition at line 183 of file ExtensionFunction.java.

References com.mapd.parser.server.ExtensionFunction.options.

183  {
184  if (this.options != null) {
185  return new HashMap<String, String>(this.options);
186  }
187  return null;
188  }
List<String> com.mapd.parser.server.ExtensionFunction.getOutNames ( )
inline

Definition at line 167 of file ExtensionFunction.java.

References com.mapd.parser.server.ExtensionFunction.names.

167  {
168  if (this.names != null) {
169  return this.names.subList(this.args.size(), this.names.size());
170  }
171  return null;
172  }
List<ExtArgumentType> com.mapd.parser.server.ExtensionFunction.getOuts ( )
inline

Definition at line 143 of file ExtensionFunction.java.

143  {
144  return this.outs;
145  }
List<String> com.mapd.parser.server.ExtensionFunction.getPrettyArgNames ( )
inline

Definition at line 154 of file ExtensionFunction.java.

References com.mapd.parser.server.ExtensionFunction.names, and split().

154  {
155  if (this.names != null) {
156  List<String> pretty_names = new ArrayList<String>();
157  for (int arg_idx = 0; arg_idx < this.args.size(); ++arg_idx) {
158  // Split on first array opening bracket and take everything preceding
159  // For names without array brackets this will just be the name
160  pretty_names.add(this.names.get(arg_idx).split("\\[", 2)[0]);
161  }
162  return pretty_names;
163  }
164  return null;
165  }
std::vector< std::string > split(std::string_view str, std::string_view delim, std::optional< size_t > maxsplit)
split apart a string into a vector of substrings

+ Here is the call graph for this function:

ExtArgumentType com.mapd.parser.server.ExtensionFunction.getRet ( )
inline

Definition at line 174 of file ExtensionFunction.java.

174  {
175  return this.ret;
176  }
SqlTypeName com.mapd.parser.server.ExtensionFunction.getSqlRet ( )
inline

Definition at line 178 of file ExtensionFunction.java.

References com.mapd.parser.server.ExtensionFunction.ret, and com.mapd.parser.server.ExtensionFunction.toSqlTypeName().

178  {
179  assert this.isRowUdf();
180  return toSqlTypeName(this.ret);
181  }
static ExtArgumentType toSqlTypeName(final String type)

+ Here is the call graph for this function:

static ExtArgumentType com.mapd.parser.server.ExtensionFunction.getValueType ( final ExtArgumentType  type)
inlinestatic

Definition at line 470 of file ExtensionFunction.java.

References com.mapd.parser.server.ExtensionFunction.ExtArgumentType.ArrayBool, ArrayBool, com.mapd.parser.server.ExtensionFunction.ExtArgumentType.ArrayDouble, ArrayDouble, com.mapd.parser.server.ExtensionFunction.ExtArgumentType.ArrayFloat, ArrayFloat, com.mapd.parser.server.ExtensionFunction.ExtArgumentType.ArrayInt16, ArrayInt16, com.mapd.parser.server.ExtensionFunction.ExtArgumentType.ArrayInt32, ArrayInt32, com.mapd.parser.server.ExtensionFunction.ExtArgumentType.ArrayInt64, ArrayInt64, com.mapd.parser.server.ExtensionFunction.ExtArgumentType.ArrayInt8, ArrayInt8, com.mapd.parser.server.ExtensionFunction.ExtArgumentType.ArrayTextEncodingDict, ArrayTextEncodingDict, com.mapd.parser.server.ExtensionFunction.ExtArgumentType.Bool, Bool, ColumnArrayBool, ColumnArrayDouble, ColumnArrayFloat, ColumnArrayInt16, ColumnArrayInt32, ColumnArrayInt64, ColumnArrayInt8, ColumnArrayTextEncodingDict, ColumnBool, ColumnDouble, ColumnFloat, ColumnInt16, ColumnInt32, ColumnInt64, ColumnInt8, ColumnListArrayBool, ColumnListArrayDouble, ColumnListArrayFloat, ColumnListArrayInt16, ColumnListArrayInt32, ColumnListArrayInt64, ColumnListArrayInt8, ColumnListArrayTextEncodingDict, ColumnListBool, ColumnListDouble, ColumnListFloat, ColumnListInt16, ColumnListInt32, ColumnListInt64, ColumnListInt8, ColumnListTextEncodingDict, ColumnTextEncodingDict, ColumnTimestamp, com.mapd.parser.server.ExtensionFunction.ExtArgumentType.Double, Double, com.mapd.parser.server.ExtensionFunction.ExtArgumentType.Float, Float, com.mapd.parser.server.ExtensionFunction.ExtArgumentType.Int16, Int16, com.mapd.parser.server.ExtensionFunction.ExtArgumentType.Int32, Int32, com.mapd.parser.server.ExtensionFunction.ExtArgumentType.Int64, Int64, com.mapd.parser.server.ExtensionFunction.ExtArgumentType.Int8, Int8, PBool, PDouble, PFloat, PInt16, PInt32, PInt64, PInt8, com.mapd.parser.server.ExtensionFunction.ExtArgumentType.TextEncodingDict, com.mapd.parser.server.ExtensionFunction.ExtArgumentType.Timestamp, and run_benchmark_import.type.

Referenced by com.mapd.calcite.parser.HeavyDBSqlOperatorTable.ExtFunction.inferReturnType().

470  {
471  switch (type) {
472  case PInt8:
473  case ArrayInt8:
474  case ColumnInt8:
475  case ColumnListInt8:
476  case Int8:
477  return ExtArgumentType.Int8;
478  case ArrayInt16:
479  case PInt16:
480  case ColumnInt16:
481  case ColumnListInt16:
482  case Int16:
483  return ExtArgumentType.Int16;
484  case ArrayInt32:
485  case PInt32:
486  case ColumnInt32:
487  case ColumnListInt32:
488  case Int32:
489  return ExtArgumentType.Int32;
490  case ArrayInt64:
491  case PInt64:
492  case ColumnInt64:
493  case ColumnListInt64:
494  case Int64:
495  return ExtArgumentType.Int64;
496  case ArrayFloat:
497  case PFloat:
498  case ColumnFloat:
499  case ColumnListFloat:
500  case Float:
501  return ExtArgumentType.Float;
502  case ArrayDouble:
503  case PDouble:
504  case ColumnDouble:
505  case ColumnListDouble:
506  case Double:
507  return ExtArgumentType.Double;
508  case ArrayBool:
509  case PBool:
510  case ColumnBool:
511  case ColumnListBool:
512  case Bool:
513  return ExtArgumentType.Bool;
514  case TextEncodingDict:
522  case ColumnTimestamp:
524  case ColumnArrayInt8:
526  case ColumnArrayInt16:
528  case ColumnArrayInt32:
530  case ColumnArrayInt64:
532  case ColumnArrayFloat:
534  case ColumnArrayDouble:
536  case ColumnArrayBool:
538  case ColumnListArrayInt8:
550  case ColumnListArrayBool:
552  }
553  HEAVYDBLOGGER.error("getValueType: no value for type " + type);
554  assert false;
555  return null;
556  }

+ Here is the caller graph for this function:

static boolean com.mapd.parser.server.ExtensionFunction.isArrayType ( final ExtArgumentType  type)
inlinestatic

Definition at line 430 of file ExtensionFunction.java.

References com.mapd.parser.server.ExtensionFunction.ExtArgumentType.ArrayTextEncodingDict.

Referenced by com.mapd.calcite.parser.HeavyDBSqlOperatorTable.ExtFunction.inferReturnType().

430  {
431  return type == ExtArgumentType.ArrayInt8 || type == ExtArgumentType.ArrayInt16
432  || type == ExtArgumentType.ArrayInt32 || type == ExtArgumentType.ArrayInt64
433  || type == ExtArgumentType.ArrayFloat || type == ExtArgumentType.ArrayDouble
434  || type == ExtArgumentType.ArrayBool
436  }

+ Here is the caller graph for this function:

static boolean com.mapd.parser.server.ExtensionFunction.isColumnArrayType ( final ExtArgumentType  type)
inlinestatic

Definition at line 419 of file ExtensionFunction.java.

References com.mapd.parser.server.ExtensionFunction.ExtArgumentType.ColumnArrayTextEncodingDict.

Referenced by com.mapd.calcite.parser.HeavyDBSqlOperatorTable.ExtTableFunction.getRowTypeInference(), and com.mapd.parser.server.ExtensionFunction.isColumnType().

419  {
420  return type == ExtArgumentType.ColumnArrayInt8
421  || type == ExtArgumentType.ColumnArrayInt16
422  || type == ExtArgumentType.ColumnArrayInt32
423  || type == ExtArgumentType.ColumnArrayInt64
424  || type == ExtArgumentType.ColumnArrayFloat
425  || type == ExtArgumentType.ColumnArrayDouble
426  || type == ExtArgumentType.ColumnArrayBool
428  }

+ Here is the caller graph for this function:

static boolean com.mapd.parser.server.ExtensionFunction.isColumnListArrayType ( final ExtArgumentType  type)
inlinestatic

Definition at line 438 of file ExtensionFunction.java.

References com.mapd.parser.server.ExtensionFunction.ExtArgumentType.ColumnListArrayTextEncodingDict.

Referenced by com.mapd.parser.server.ExtensionFunction.isColumnListType().

438  {
439  return type == ExtArgumentType.ColumnListArrayInt8
440  || type == ExtArgumentType.ColumnListArrayInt16
441  || type == ExtArgumentType.ColumnListArrayInt32
442  || type == ExtArgumentType.ColumnListArrayInt64
443  || type == ExtArgumentType.ColumnListArrayFloat
444  || type == ExtArgumentType.ColumnListArrayDouble
445  || type == ExtArgumentType.ColumnListArrayBool
447  }

+ Here is the caller graph for this function:

static boolean com.mapd.parser.server.ExtensionFunction.isColumnListType ( final ExtArgumentType  type)
inlinestatic

Definition at line 458 of file ExtensionFunction.java.

References com.mapd.parser.server.ExtensionFunction.isColumnListArrayType().

458  {
459  return type == ExtArgumentType.ColumnListInt8
460  || type == ExtArgumentType.ColumnListInt16
461  || type == ExtArgumentType.ColumnListInt32
462  || type == ExtArgumentType.ColumnListInt64
463  || type == ExtArgumentType.ColumnListFloat
464  || type == ExtArgumentType.ColumnListDouble
465  || type == ExtArgumentType.ColumnListBool
466  || type == ExtArgumentType.ColumnListTextEncodingDict
468  }
static boolean isColumnListArrayType(final ExtArgumentType type)

+ Here is the call graph for this function:

static boolean com.mapd.parser.server.ExtensionFunction.isColumnType ( final ExtArgumentType  type)
inlinestatic

Definition at line 449 of file ExtensionFunction.java.

References com.mapd.parser.server.ExtensionFunction.isColumnArrayType().

449  {
450  return type == ExtArgumentType.ColumnInt8 || type == ExtArgumentType.ColumnInt16
451  || type == ExtArgumentType.ColumnInt32 || type == ExtArgumentType.ColumnInt64
452  || type == ExtArgumentType.ColumnFloat || type == ExtArgumentType.ColumnDouble
453  || type == ExtArgumentType.ColumnBool
454  || type == ExtArgumentType.ColumnTextEncodingDict
455  || type == ExtArgumentType.ColumnTimestamp || isColumnArrayType(type);
456  }
static boolean isColumnArrayType(final ExtArgumentType type)

+ Here is the call graph for this function:

static boolean com.mapd.parser.server.ExtensionFunction.isPointerType ( final ExtArgumentType  type)
inlinestatic

Definition at line 412 of file ExtensionFunction.java.

References com.mapd.parser.server.ExtensionFunction.ExtArgumentType.PBool.

Referenced by com.mapd.parser.server.ExtensionFunction.toSqlSignature().

412  {
413  return type == ExtArgumentType.PInt8 || type == ExtArgumentType.PInt16
414  || type == ExtArgumentType.PInt32 || type == ExtArgumentType.PInt64
415  || type == ExtArgumentType.PFloat || type == ExtArgumentType.PDouble
417  }

+ Here is the caller graph for this function:

boolean com.mapd.parser.server.ExtensionFunction.isRowUdf ( )
inline

Definition at line 190 of file ExtensionFunction.java.

Referenced by com.mapd.parser.server.ExtensionFunction.toJson(), and com.mapd.parser.server.ExtensionFunction.toSqlSignature().

190  {
191  return this.isRowUdf;
192  }

+ Here is the caller graph for this function:

boolean com.mapd.parser.server.ExtensionFunction.isTableUdf ( )
inline

Definition at line 194 of file ExtensionFunction.java.

Referenced by com.mapd.parser.server.ExtensionFunction.getCursorFieldTypes().

194  {
195  return !this.isRowUdf();
196  }

+ Here is the caller graph for this function:

String com.mapd.parser.server.ExtensionFunction.toJson ( final String  name)
inline

Definition at line 198 of file ExtensionFunction.java.

References com.mapd.parser.server.ExtensionFunction.annotations, File_Namespace.append(), com.mapd.parser.server.ExtensionFunction.args, com.mapd.parser.server.ExtensionFunction.dq(), com.mapd.parser.server.ExtensionFunction.isRowUdf(), setup.name, com.mapd.parser.server.ExtensionFunction.outs, com.mapd.parser.server.ExtensionFunction.ret, and com.mapd.parser.server.ExtensionFunction.typeName().

198  {
199  HEAVYDBLOGGER.debug("Extensionfunction::toJson: " + name);
200  StringBuilder json_cons = new StringBuilder();
201  json_cons.append("{");
202  json_cons.append("\"name\":").append(dq(name)).append(",");
203  if (isRowUdf) {
204  json_cons.append("\"annotations\":");
205  List<String> anns = new ArrayList<String>();
206  for (final Map<String, String> m : this.annotations) {
207  List<String> lst = new ArrayList<String>();
208  for (final Map.Entry<String, String> kv : m.entrySet()) {
209  lst.add("\"" + kv.getKey() + "\":\"" + kv.getValue() + "\"");
210  }
211  anns.add("{" + ExtensionFunctionSignatureParser.join(lst, ",") + "}");
212  }
213  json_cons.append("[" + ExtensionFunctionSignatureParser.join(anns, ",") + "],");
214  json_cons.append("\"ret\":").append(dq(typeName(ret))).append(",");
215  } else {
216  json_cons.append("\"outs\":");
217  json_cons.append("[");
218  List<String> param_list = new ArrayList<String>();
219  for (final ExtArgumentType out : outs) {
220  param_list.add(dq(typeName(out)));
221  }
222  json_cons.append(ExtensionFunctionSignatureParser.join(param_list, ","));
223  json_cons.append("],");
224  }
225  json_cons.append("\"args\":");
226  json_cons.append("[");
227  List<String> param_list = new ArrayList<String>();
228  for (final ExtArgumentType arg : args) {
229  param_list.add(dq(typeName(arg)));
230  }
231  json_cons.append(ExtensionFunctionSignatureParser.join(param_list, ","));
232  json_cons.append("]");
233  json_cons.append("}");
234  return json_cons.toString();
235  }
size_t append(FILE *f, const size_t size, const int8_t *buf)
Appends the specified number of bytes to the end of the file f from buf.
Definition: File.cpp:168
static String typeName(final ExtArgumentType type)
final List< Map< String, String > > annotations
static String dq(final String str)
string name
Definition: setup.in.py:72

+ Here is the call graph for this function:

final java.util.List<SqlTypeFamily> com.mapd.parser.server.ExtensionFunction.toSqlSignature ( )
inline

Definition at line 395 of file ExtensionFunction.java.

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

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

395  {
396  java.util.List<SqlTypeFamily> sql_sig = new java.util.ArrayList<SqlTypeFamily>();
397  boolean isRowUdf = this.isRowUdf();
398  for (int arg_idx = 0; arg_idx < this.getArgs().size(); ++arg_idx) {
399  final ExtArgumentType arg_type = this.getArgs().get(arg_idx);
400  if (isRowUdf) {
401  sql_sig.add(toSqlTypeName(arg_type).getFamily());
402  if (isPointerType(arg_type)) {
403  ++arg_idx;
404  }
405  } else {
406  sql_sig.add(toSqlTypeName(arg_type).getFamily());
407  }
408  }
409  return sql_sig;
410  }
static ExtArgumentType toSqlTypeName(final String type)
static boolean isPointerType(final ExtArgumentType type)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ExtArgumentType com.mapd.parser.server.ExtensionFunction.toSqlTypeName ( final String  type)
inlinestatic

Definition at line 558 of file ExtensionFunction.java.

References run_benchmark_import.type.

Referenced by com.mapd.parser.server.ExtensionFunction.getSqlRet(), and com.mapd.parser.server.ExtensionFunction.toSqlSignature().

558  {
559  return ExtArgumentType.valueOf(type);
560  }

+ Here is the caller graph for this function:

static SqlTypeName com.mapd.parser.server.ExtensionFunction.toSqlTypeName ( final ExtArgumentType  type)
inlinestatic

Definition at line 562 of file ExtensionFunction.java.

References ArrayBool, ArrayDouble, ArrayFloat, ArrayInt16, ArrayInt32, ArrayInt64, ArrayInt8, ArrayTextEncodingDict, Bool, ColumnArrayBool, ColumnArrayDouble, ColumnArrayFloat, ColumnArrayInt16, ColumnArrayInt32, ColumnArrayInt64, ColumnArrayInt8, ColumnArrayTextEncodingDict, ColumnBool, ColumnDouble, ColumnFloat, ColumnInt16, ColumnInt32, ColumnInt64, ColumnInt8, ColumnListArrayBool, ColumnListArrayDouble, ColumnListArrayFloat, ColumnListArrayInt16, ColumnListArrayInt32, ColumnListArrayInt64, ColumnListArrayInt8, ColumnListArrayTextEncodingDict, ColumnListBool, ColumnListDouble, ColumnListFloat, ColumnListInt16, ColumnListInt32, ColumnListInt64, ColumnListInt8, ColumnListTextEncodingDict, ColumnTextEncodingDict, ColumnTimestamp, Cursor, Double, Float, Int16, Int32, Int64, Int8, PBool, PDouble, PFloat, PInt16, PInt32, PInt64, PInt8, and Void.

562  {
563  switch (type) {
564  // Column types are mapped to their underlying type for CURSOR typechecking
565  case Bool:
566  case ColumnBool:
567  return SqlTypeName.BOOLEAN;
568  case ColumnInt8:
569  case Int8:
570  return SqlTypeName.TINYINT;
571  case ColumnInt16:
572  case Int16:
573  return SqlTypeName.SMALLINT;
574  case Int32:
575  case ColumnInt32:
576  return SqlTypeName.INTEGER;
577  case Int64:
578  case ColumnInt64:
579  return SqlTypeName.BIGINT;
580  case Float:
581  case ColumnFloat:
582  return SqlTypeName.FLOAT;
583  case Double:
584  case ColumnDouble:
585  return SqlTypeName.DOUBLE;
586  case PInt8:
587  case PInt16:
588  case PInt32:
589  case PInt64:
590  case PFloat:
591  case PDouble:
592  case PBool:
593  case ArrayInt8:
594  case ArrayInt16:
595  case ArrayInt32:
596  case ArrayInt64:
597  case ArrayFloat:
598  case ArrayDouble:
599  case ArrayBool:
601  return SqlTypeName.ARRAY;
602  case ColumnArrayInt8:
603  case ColumnArrayInt16:
604  case ColumnArrayInt32:
605  case ColumnArrayInt64:
606  case ColumnArrayFloat:
607  case ColumnArrayDouble:
608  case ColumnArrayBool:
610  return SqlTypeName.ARRAY;
611  case GeoPoint:
612  case GeoMultiPoint:
613  case GeoLineString:
614  case GeoMultiLineString:
615  case GeoPolygon:
616  case GeoMultiPolygon:
617  return SqlTypeName.GEOMETRY;
618  case Cursor:
619  return SqlTypeName.CURSOR;
620  case TextEncodingNone:
621  case TextEncodingDict:
623  return SqlTypeName.VARCHAR;
624  case Timestamp:
625  case ColumnTimestamp:
626  return SqlTypeName.TIMESTAMP;
627  case ColumnListInt8:
628  case ColumnListInt16:
629  case ColumnListInt32:
630  case ColumnListInt64:
631  case ColumnListFloat:
632  case ColumnListDouble:
633  case ColumnListBool:
634  case ColumnListArrayInt8:
640  case ColumnListArrayBool:
643  return SqlTypeName.COLUMN_LIST;
644  case DayTimeInterval:
645  return SqlTypeName.INTERVAL_DAY_HOUR;
647  return SqlTypeName.INTERVAL_YEAR_MONTH;
648  case Void:
649  // some extension functions return void. these functions should be defined in
650  // HeavyDBSqlOperatorTable and never have their definition set from the AST file
651  return null;
652  }
653  Set<SqlTypeName> allSqlTypeNames = EnumSet.allOf(SqlTypeName.class);
654  HEAVYDBLOGGER.error("toSqlTypeName: unknown type " + type + " to be mapped to {"
655  + allSqlTypeNames + "}");
656  assert false;
657  return null;
658  }
Simplified core of GeoJSON Polygon coordinates definition.
Definition: heavydbTypes.h:636
Simplified core of GeoJSON MultiPolygon coordinates definition.
Definition: heavydbTypes.h:657
static String com.mapd.parser.server.ExtensionFunction.typeName ( final ExtArgumentType  type)
inlinestaticprivate

Definition at line 237 of file ExtensionFunction.java.

References ArrayBool, ArrayDouble, ArrayFloat, ArrayInt16, ArrayInt32, ArrayInt64, ArrayInt8, ArrayTextEncodingDict, Bool, ColumnArrayBool, ColumnArrayDouble, ColumnArrayFloat, ColumnArrayInt16, ColumnArrayInt32, ColumnArrayInt64, ColumnArrayInt8, ColumnArrayTextEncodingDict, ColumnBool, ColumnDouble, ColumnFloat, ColumnInt16, ColumnInt32, ColumnInt64, ColumnInt8, ColumnListArrayBool, ColumnListArrayDouble, ColumnListArrayFloat, ColumnListArrayInt16, ColumnListArrayInt32, ColumnListArrayInt64, ColumnListArrayInt8, ColumnListArrayTextEncodingDict, ColumnListBool, ColumnListDouble, ColumnListFloat, ColumnListInt16, ColumnListInt32, ColumnListInt64, ColumnListInt8, ColumnListTextEncodingDict, ColumnTextEncodingDict, ColumnTimestamp, Cursor, Double, Float, Int16, Int32, Int64, Int8, PBool, PDouble, PFloat, PInt16, PInt32, PInt64, PInt8, and Void.

Referenced by com.mapd.parser.server.ExtensionFunction.toJson().

237  {
238  switch (type) {
239  case Bool:
240  return "i1";
241  case Int8:
242  return "i8";
243  case Int16:
244  return "i16";
245  case Int32:
246  return "i32";
247  case Int64:
248  return "i64";
249  case Float:
250  return "float";
251  case Double:
252  return "double";
253  case Void:
254  return "void";
255  case PInt8:
256  return "i8*";
257  case PInt16:
258  return "i16*";
259  case PInt32:
260  return "i32*";
261  case PInt64:
262  return "i64*";
263  case PFloat:
264  return "float*";
265  case PDouble:
266  return "double*";
267  case PBool:
268  return "i1*";
269  case ArrayInt8:
270  return "Array<i8>";
271  case ArrayInt16:
272  return "Array<i16>";
273  case ArrayInt32:
274  return "Array<i32>";
275  case ArrayInt64:
276  return "Array<i64>";
277  case ArrayFloat:
278  return "Array<float>";
279  case ArrayDouble:
280  return "Array<double>";
281  case ArrayBool:
282  return "Array<bool>";
284  return "Array<TextEncodingDict>";
285  case ColumnInt8:
286  return "Column<i8>";
287  case ColumnInt16:
288  return "Column<i16>";
289  case ColumnInt32:
290  return "Column<i32>";
291  case ColumnInt64:
292  return "Column<i64>";
293  case ColumnFloat:
294  return "Column<float>";
295  case ColumnDouble:
296  return "Column<double>";
297  case ColumnBool:
298  return "Column<bool>";
300  return "Column<TextEncodingDict>";
301  case ColumnTimestamp:
302  return "Column<timestamp>";
303  case GeoPoint:
304  return "geo_point";
305  case GeoMultiPoint:
306  return "geo_multi_point";
307  case Cursor:
308  return "cursor";
309  case GeoLineString:
310  return "geo_linestring";
311  case GeoMultiLineString:
312  return "geo_multi_linestring";
313  case GeoPolygon:
314  return "geo_polygon";
315  case GeoMultiPolygon:
316  return "geo_multi_polygon";
317  case Timestamp:
318  return "timestamp";
319  case TextEncodingNone:
320  return "TextEncodingNone";
321  case TextEncodingDict:
322  return "TextEncodingDict";
323  case ColumnListInt8:
324  return "ColumnList<i8>";
325  case ColumnListInt16:
326  return "ColumnList<i16>";
327  case ColumnListInt32:
328  return "ColumnList<i32>";
329  case ColumnListInt64:
330  return "ColumnList<i64>";
331  case ColumnListFloat:
332  return "ColumnList<float>";
333  case ColumnListDouble:
334  return "ColumnList<double>";
335  case ColumnListBool:
336  return "ColumnList<bool>";
338  return "ColumnList<TextEncodingDict>";
339  case ColumnArrayInt8:
340  return "Column<Array<i8>>";
341  case ColumnArrayInt16:
342  return "Column<Array<i16>>";
343  case ColumnArrayInt32:
344  return "Column<Array<i32>>";
345  case ColumnArrayInt64:
346  return "Column<Array<i64>>";
347  case ColumnArrayFloat:
348  return "Column<Array<float>>";
349  case ColumnArrayDouble:
350  return "Column<Array<double>>";
351  case ColumnArrayBool:
352  return "Column<Array<bool>>";
354  return "Column<Array<TextEncodingDict>>";
355  case ColumnListArrayInt8:
356  return "ColumnList<Array<i8>>";
358  return "ColumnList<Array<i16>>";
360  return "ColumnList<Array<i32>>";
362  return "ColumnList<Array<i64>>";
364  return "ColumnList<Array<float>>";
366  return "ColumnList<Array<double>>";
367  case ColumnListArrayBool:
368  return "ColumnList<Array<bool>>";
370  return "ColumnList<Array<TextEncodingDict>>";
371  case DayTimeInterval:
372  return "DayTimeInterval";
374  return "YearMonthTimeInterval";
375  }
376  HEAVYDBLOGGER.info("Extensionfunction::typeName: unknown type=`" + type + "`");
377  assert false;
378  return null;
379  }
Simplified core of GeoJSON Polygon coordinates definition.
Definition: heavydbTypes.h:636
Simplified core of GeoJSON MultiPolygon coordinates definition.
Definition: heavydbTypes.h:657

+ Here is the caller graph for this function:

Member Data Documentation

final Map<String, List<ExtArgumentType> > com.mapd.parser.server.ExtensionFunction.cursor_field_types
private
final Logger com.mapd.parser.server.ExtensionFunction.HEAVYDBLOGGER = LoggerFactory.getLogger(ExtensionFunction.class)
staticpackage

Definition at line 32 of file ExtensionFunction.java.

final boolean com.mapd.parser.server.ExtensionFunction.isRowUdf
private

Definition at line 389 of file ExtensionFunction.java.

final Map<String, String> com.mapd.parser.server.ExtensionFunction.options
private
final List<ExtArgumentType> com.mapd.parser.server.ExtensionFunction.outs
private

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