OmniSciDB  6686921089
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
sqltypes.h
Go to the documentation of this file.
1 /*
2  * Copyright 2020 OmniSci, Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
23 #pragma once
24 
25 #include "../Logger/Logger.h"
26 #include "StringTransform.h"
27 #include "funcannotations.h"
28 
29 #include <cassert>
30 #include <ctime>
31 #include <memory>
32 #include <ostream>
33 #include <string>
34 #include <type_traits>
35 #include <vector>
36 
37 // must not change because these values persist in catalogs.
38 enum SQLTypes {
39  kNULLT = 0, // type for null values
40  kBOOLEAN = 1,
41  kCHAR = 2,
42  kVARCHAR = 3,
43  kNUMERIC = 4,
44  kDECIMAL = 5,
45  kINT = 6,
46  kSMALLINT = 7,
47  kFLOAT = 8,
48  kDOUBLE = 9,
49  kTIME = 10,
50  kTIMESTAMP = 11,
51  kBIGINT = 12,
52  kTEXT = 13,
53  kDATE = 14,
54  kARRAY = 15,
57  kPOINT = 18,
59  kPOLYGON = 20,
61  kTINYINT = 22,
62  kGEOMETRY = 23,
63  kGEOGRAPHY = 24,
64  kEVAL_CONTEXT_TYPE = 25, // Placeholder Type for ANY
65  kVOID = 26,
66  kCURSOR = 27,
67  kCOLUMN = 28,
70 };
71 
72 #ifndef __CUDACC__
73 
74 inline std::string toString(const SQLTypes& type) {
75  switch (type) {
76  case kNULLT:
77  return "NULL";
78  case kBOOLEAN:
79  return "BOOL";
80  case kCHAR:
81  return "CHAR";
82  case kVARCHAR:
83  return "VARCHAR";
84  case kNUMERIC:
85  return "NUMERIC";
86  case kDECIMAL:
87  return "DECIMAL";
88  case kINT:
89  return "INT";
90  case kSMALLINT:
91  return "SMALLINT";
92  case kFLOAT:
93  return "FLOAT";
94  case kDOUBLE:
95  return "DOUBLE";
96  case kTIME:
97  return "TIME";
98  case kTIMESTAMP:
99  return "TIMESTAMP";
100  case kBIGINT:
101  return "BIGINT";
102  case kTEXT:
103  return "TEXT";
104  case kDATE:
105  return "DATE";
106  case kARRAY:
107  return "ARRAY";
108  case kINTERVAL_DAY_TIME:
109  return "DAY TIME INTERVAL";
111  return "YEAR MONTH INTERVAL";
112  case kPOINT:
113  return "POINT";
114  case kLINESTRING:
115  return "LINESTRING";
116  case kPOLYGON:
117  return "POLYGON";
118  case kMULTIPOLYGON:
119  return "MULTIPOLYGON";
120  case kTINYINT:
121  return "TINYINT";
122  case kGEOMETRY:
123  return "GEOMETRY";
124  case kGEOGRAPHY:
125  return "GEOGRAPHY";
126  case kEVAL_CONTEXT_TYPE:
127  return "UNEVALUATED ANY";
128  case kVOID:
129  return "VOID";
130  case kCURSOR:
131  return "CURSOR";
132  case kCOLUMN:
133  return "COLUMN";
134  case kCOLUMN_LIST:
135  return "COLUMN_LIST";
136  case kSQLTYPE_LAST:
137  break;
138  }
139  LOG(FATAL) << "Invalid SQL type: " << type;
140  return "";
141 }
142 
143 inline std::ostream& operator<<(std::ostream& os, SQLTypes const sql_type) {
144  os << toString(sql_type);
145  return os;
146 }
147 
148 #endif
149 
150 struct VarlenDatum {
151  size_t length;
152  int8_t* pointer;
153  bool is_null;
154 
155  DEVICE VarlenDatum() : length(0), pointer(nullptr), is_null(true) {}
156  DEVICE virtual ~VarlenDatum() {}
157 
158  VarlenDatum(const size_t l, int8_t* p, const bool n)
159  : length(l), pointer(p), is_null(n) {}
160 };
161 
163  void operator()(int8_t*) {}
164 };
165 struct FreeDeleter {
166  void operator()(int8_t* p) { free(p); }
167 };
168 
169 struct HostArrayDatum : public VarlenDatum {
170  using ManagedPtr = std::shared_ptr<int8_t>;
171 
172  HostArrayDatum() = default;
173 
174  HostArrayDatum(size_t const l, ManagedPtr p, bool const n)
175  : VarlenDatum(l, p.get(), n), data_ptr(p) {}
176 
177  HostArrayDatum(size_t const l, int8_t* p, bool const n)
178  : VarlenDatum(l, p, n), data_ptr(p, FreeDeleter()){};
179 
180  template <typename CUSTOM_DELETER,
181  typename = std::enable_if_t<
182  std::is_void<std::result_of_t<CUSTOM_DELETER(int8_t*)> >::value> >
183  HostArrayDatum(size_t const l, int8_t* p, CUSTOM_DELETER custom_deleter)
184  : VarlenDatum(l, p, 0 == l), data_ptr(p, custom_deleter) {}
185 
186  template <typename CUSTOM_DELETER,
187  typename = std::enable_if_t<
188  std::is_void<std::result_of_t<CUSTOM_DELETER(int8_t*)> >::value> >
189  HostArrayDatum(size_t const l, int8_t* p, bool const n, CUSTOM_DELETER custom_deleter)
190  : VarlenDatum(l, p, n), data_ptr(p, custom_deleter) {}
191 
193 };
194 
195 struct DeviceArrayDatum : public VarlenDatum {
197 };
198 
199 inline DEVICE constexpr bool is_cuda_compiler() {
200 #ifdef __CUDACC__
201  return true;
202 #else
203  return false;
204 #endif
205 }
206 
207 using ArrayDatum =
208  std::conditional_t<is_cuda_compiler(), DeviceArrayDatum, HostArrayDatum>;
209 
210 union Datum {
211  int8_t boolval;
212  int8_t tinyintval;
213  int16_t smallintval;
214  int32_t intval;
215  int64_t bigintval;
216  float floatval;
217  double doubleval;
219 #ifndef __CUDACC__
220  std::string* stringval; // string value
221 #endif
222 };
223 
224 #ifndef __CUDACC__
226  int8_t* numbersPtr;
227  std::vector<std::string>* stringsPtr;
228  std::vector<ArrayDatum>* arraysPtr;
229 };
230 #endif
231 
232 // must not change because these values persist in catalogs.
234  kENCODING_NONE = 0, // no encoding
235  kENCODING_FIXED = 1, // Fixed-bit encoding
236  kENCODING_RL = 2, // Run Length encoding
237  kENCODING_DIFF = 3, // Differential encoding
238  kENCODING_DICT = 4, // Dictionary encoding
239  kENCODING_SPARSE = 5, // Null encoding for sparse columns
240  kENCODING_GEOINT = 6, // Encoding coordinates as intergers
241  kENCODING_DATE_IN_DAYS = 7, // Date encoding in days
243 };
244 
245 #define IS_INTEGER(T) \
246  (((T) == kINT) || ((T) == kSMALLINT) || ((T) == kBIGINT) || ((T) == kTINYINT))
247 #define IS_NUMBER(T) \
248  (((T) == kINT) || ((T) == kSMALLINT) || ((T) == kDOUBLE) || ((T) == kFLOAT) || \
249  ((T) == kBIGINT) || ((T) == kNUMERIC) || ((T) == kDECIMAL) || ((T) == kTINYINT))
250 #define IS_STRING(T) (((T) == kTEXT) || ((T) == kVARCHAR) || ((T) == kCHAR))
251 #define IS_GEO(T) \
252  (((T) == kPOINT) || ((T) == kLINESTRING) || ((T) == kPOLYGON) || ((T) == kMULTIPOLYGON))
253 #define IS_INTERVAL(T) ((T) == kINTERVAL_DAY_TIME || (T) == kINTERVAL_YEAR_MONTH)
254 #define IS_DECIMAL(T) ((T) == kNUMERIC || (T) == kDECIMAL)
255 #define IS_GEO_POLY(T) (((T) == kPOLYGON) || ((T) == kMULTIPOLYGON))
256 
257 #include "InlineNullValues.h"
258 
259 #define TRANSIENT_DICT_ID 0
260 #define TRANSIENT_DICT(ID) (-(ID))
261 #define REGULAR_DICT(TRANSIENTID) (-(TRANSIENTID))
262 
263 constexpr auto is_datetime(SQLTypes type) {
264  return type == kTIME || type == kTIMESTAMP || type == kDATE;
265 }
266 
267 // @type SQLTypeInfo
268 // @brief a structure to capture all type information including
269 // length, precision, scale, etc.
270 class SQLTypeInfo {
271  public:
272  SQLTypeInfo(SQLTypes t, int d, int s, bool n, EncodingType c, int p, SQLTypes st)
273  : type(t)
274  , subtype(st)
275  , dimension(d)
276  , scale(s)
277  , notnull(n)
278  , compression(c)
279  , comp_param(p)
280  , size(get_storage_size()) {}
281  SQLTypeInfo(SQLTypes t, int d, int s, bool n)
282  : type(t)
283  , subtype(kNULLT)
284  , dimension(d)
285  , scale(s)
286  , notnull(n)
288  , comp_param(0)
289  , size(get_storage_size()) {}
291  : type(t)
292  , subtype(st)
293  , dimension(0)
294  , scale(0)
295  , notnull(false)
296  , compression(c)
297  , comp_param(p)
298  , size(get_storage_size()) {}
299  SQLTypeInfo(SQLTypes t, int d, int s) : SQLTypeInfo(t, d, s, false) {}
301  : type(t)
302  , subtype(kNULLT)
303  , dimension(0)
304  , scale(0)
305  , notnull(n)
307  , comp_param(0)
308  , size(get_storage_size()) {}
311  : type(t)
312  , subtype(kNULLT)
313  , dimension(0)
314  , scale(0)
315  , notnull(n)
316  , compression(c)
317  , comp_param(0)
318  , size(get_storage_size()) {}
320  : type(kNULLT)
321  , subtype(kNULLT)
322  , dimension(0)
323  , scale(0)
324  , notnull(false)
326  , comp_param(0)
327  , size(0) {}
328 
329  HOST DEVICE inline SQLTypes get_type() const { return type; }
330  HOST DEVICE inline SQLTypes get_subtype() const { return subtype; }
331  HOST DEVICE inline int get_dimension() const { return dimension; }
332  inline int get_precision() const { return dimension; }
333  HOST DEVICE inline int get_input_srid() const { return dimension; }
334  HOST DEVICE inline int get_scale() const { return scale; }
335  HOST DEVICE inline int get_output_srid() const { return scale; }
336  HOST DEVICE inline bool get_notnull() const { return notnull; }
338  HOST DEVICE inline int get_comp_param() const { return comp_param; }
339  HOST DEVICE inline int get_size() const { return size; }
340  inline int get_logical_size() const {
343  return ti.get_size();
344  }
345  if (compression == kENCODING_DICT) {
346  return 4;
347  }
348  return get_size();
349  }
350  inline int get_physical_cols() const {
351  switch (type) {
352  case kPOINT:
353  return 1; // coords
354  case kLINESTRING:
355  return 2; // coords, bounds
356  case kPOLYGON:
357  return 4; // coords, ring_sizes, bounds, render_group
358  case kMULTIPOLYGON:
359  return 5; // coords, ring_sizes, poly_rings, bounds, render_group
360  default:
361  break;
362  }
363  return 0;
364  }
365  inline int get_physical_coord_cols() const {
366  // @TODO dmitri/simon rename this function?
367  // It needs to return the number of extra columns
368  // which need to go through the executor, as opposed
369  // to those which are only needed by CPU for poly
370  // cache building or what-not. For now, we just omit
371  // the Render Group column. If we add Bounding Box
372  // or something this may require rethinking. Perhaps
373  // these two functions need to return an array of
374  // offsets rather than just a number to loop over,
375  // so that executor and non-executor columns can
376  // be mixed.
377  // NOTE(adb): In binding to extension functions, we need to know some pretty specific
378  // type info about each of the physical coords cols for each geo type. I added checks
379  // there to ensure the physical coords col for the geo type match what we expect. If
380  // these values are ever changed, corresponding values in
381  // ExtensionFunctionsBinding.cpp::compute_narrowing_conv_scores and
382  // ExtensionFunctionsBinding.cpp::compute_widening_conv_scores will also need to be
383  // changed.
384  switch (type) {
385  case kPOINT:
386  return 1;
387  case kLINESTRING:
388  return 1; // omit bounds
389  case kPOLYGON:
390  return 2; // omit bounds, render group
391  case kMULTIPOLYGON:
392  return 3; // omit bounds, render group
393  default:
394  break;
395  }
396  return 0;
397  }
398  inline bool has_bounds() const {
399  switch (type) {
400  case kLINESTRING:
401  case kPOLYGON:
402  case kMULTIPOLYGON:
403  return true;
404  default:
405  break;
406  }
407  return false;
408  }
409  inline bool has_render_group() const {
410  switch (type) {
411  case kPOLYGON:
412  case kMULTIPOLYGON:
413  return true;
414  default:
415  break;
416  }
417  return false;
418  }
419  HOST DEVICE inline void set_type(SQLTypes t) { type = t; }
420  HOST DEVICE inline void set_subtype(SQLTypes st) { subtype = st; }
421  inline void set_dimension(int d) { dimension = d; }
422  inline void set_precision(int d) { dimension = d; }
423  inline void set_input_srid(int d) { dimension = d; }
424  inline void set_scale(int s) { scale = s; }
425  inline void set_output_srid(int s) { scale = s; }
426  inline void set_notnull(bool n) { notnull = n; }
427  inline void set_size(int s) { size = s; }
428  inline void set_fixed_size() { size = get_storage_size(); }
429  inline void set_compression(EncodingType c) { compression = c; }
430  inline void set_comp_param(int p) { comp_param = p; }
431 #ifndef __CUDACC__
432  inline std::string get_type_name() const {
433  if (IS_GEO(type)) {
434  std::string srid_string = "";
435  if (get_output_srid() > 0) {
436  srid_string = ", " + std::to_string(get_output_srid());
437  }
438  CHECK_LT(static_cast<int>(subtype), kSQLTYPE_LAST);
439  return type_name[static_cast<int>(subtype)] + "(" +
440  type_name[static_cast<int>(type)] + srid_string + ")";
441  }
442  std::string ps = "";
443  if (type == kDECIMAL || type == kNUMERIC) {
444  ps = "(" + std::to_string(dimension) + "," + std::to_string(scale) + ")";
445  } else if (type == kTIMESTAMP) {
446  ps = "(" + std::to_string(dimension) + ")";
447  }
448  if (type == kARRAY) {
449  auto elem_ti = get_elem_type();
450  auto num_elems = (size > 0) ? std::to_string(size / elem_ti.get_size()) : "";
451  CHECK_LT(static_cast<int>(subtype), kSQLTYPE_LAST);
452  return elem_ti.get_type_name() + ps + "[" + num_elems + "]";
453  }
454  if (type == kCOLUMN) {
455  auto elem_ti = get_elem_type();
456  auto num_elems =
457  (size > 0) ? "[" + std::to_string(size / elem_ti.get_size()) + "]" : "";
458  CHECK_LT(static_cast<int>(subtype), kSQLTYPE_LAST);
459  return "COLUMN<" + type_name[static_cast<int>(subtype)] + ps + ">" + num_elems;
460  }
461  if (type == kCOLUMN_LIST) {
462  auto elem_ti = get_elem_type();
463  auto num_elems =
464  (size > 0) ? "[" + std::to_string(size / elem_ti.get_size()) + "]" : "";
465  CHECK_LT(static_cast<int>(subtype), kSQLTYPE_LAST);
466  return "COLUMN_LIST<" + type_name[static_cast<int>(subtype)] + ps + ">" + num_elems;
467  }
468  return type_name[static_cast<int>(type)] + ps;
469  }
470  inline std::string get_compression_name() const { return comp_name[(int)compression]; }
471  std::string toString() const { return to_string(); } // for PRINT macro
472  inline std::string to_string() const {
473  return concat("(type=",
474  type_name[static_cast<int>(type)],
475  ", dimension=",
476  get_dimension(),
477  ", scale=",
478  get_scale(),
479  ", null=",
480  get_notnull() ? "not nullable" : "nullable",
481  ", name=",
483  ", comp=",
484  get_comp_param(),
485  ", subtype=",
486  type_name[static_cast<int>(subtype)],
487  ", size=",
488  get_size(),
489  ", element_size=",
491  ")");
492  }
493  inline std::string get_buffer_name() const {
494  if (is_array()) {
495  return "Array";
496  }
497  if (is_bytes()) {
498  return "Bytes";
499  }
500 
501  if (is_column()) {
502  return "Column";
503  }
504 
505  assert(false);
506  return "";
507  }
508 #endif
509  inline bool is_string() const { return IS_STRING(type); }
510  inline bool is_string_array() const { return (type == kARRAY) && IS_STRING(subtype); }
511  inline bool is_integer() const { return IS_INTEGER(type); }
512  inline bool is_decimal() const { return type == kDECIMAL || type == kNUMERIC; }
513  inline bool is_fp() const { return type == kFLOAT || type == kDOUBLE; }
514  inline bool is_number() const { return IS_NUMBER(type); }
515  inline bool is_time() const { return is_datetime(type); }
516  inline bool is_boolean() const { return type == kBOOLEAN; }
517  inline bool is_array() const { return type == kARRAY; } // rbc Array
518  inline bool is_varlen_array() const { return type == kARRAY && size <= 0; }
519  inline bool is_fixlen_array() const { return type == kARRAY && size > 0; }
520  inline bool is_timeinterval() const { return IS_INTERVAL(type); }
521  inline bool is_geometry() const { return IS_GEO(type); }
522  inline bool is_column() const { return type == kCOLUMN; } // rbc Column
523  inline bool is_column_list() const { return type == kCOLUMN_LIST; } // rbc ColumnList
524  inline bool is_bytes() const {
525  return type == kTEXT && get_compression() == kENCODING_NONE;
526  } // rbc Bytes
527  inline bool is_buffer() const {
528  return is_array() || is_column() || is_column_list() || is_bytes();
529  }
530  inline bool transforms() const {
531  return IS_GEO(type) && get_output_srid() != get_input_srid();
532  }
533 
534  inline bool is_varlen() const { // TODO: logically this should ignore fixlen arrays
535  return (IS_STRING(type) && compression != kENCODING_DICT) || type == kARRAY ||
536  IS_GEO(type);
537  }
538 
539  // need this here till is_varlen can be fixed w/o negative impact to existing code
540  inline bool is_varlen_indeed() const {
541  // SQLTypeInfo.is_varlen() is broken with fixedlen array now
542  // and seems left broken for some concern, so fix it locally
543  return is_varlen() && !is_fixlen_array();
544  }
545 
546  inline bool is_dict_encoded_string() const {
547  return is_string() && compression == kENCODING_DICT;
548  }
549 
550  inline bool is_subtype_dict_encoded_string() const {
552  }
553 
554  inline bool is_dict_encoded_type() const {
555  return is_dict_encoded_string() ||
557  }
558 
559  HOST DEVICE inline bool operator!=(const SQLTypeInfo& rhs) const {
560  return type != rhs.get_type() || subtype != rhs.get_subtype() ||
561  dimension != rhs.get_dimension() || scale != rhs.get_scale() ||
562  compression != rhs.get_compression() ||
565  notnull != rhs.get_notnull();
566  }
567  HOST DEVICE inline bool operator==(const SQLTypeInfo& rhs) const {
568  return type == rhs.get_type() && subtype == rhs.get_subtype() &&
569  dimension == rhs.get_dimension() && scale == rhs.get_scale() &&
570  compression == rhs.get_compression() &&
573  notnull == rhs.get_notnull();
574  }
575 
576  inline int get_array_context_logical_size() const {
577  if (is_string()) {
578  auto comp_type(get_compression());
579  if (comp_type == kENCODING_DICT || comp_type == kENCODING_FIXED ||
580  comp_type == kENCODING_NONE) {
581  return sizeof(int32_t);
582  }
583  }
584  return get_logical_size();
585  }
586 
587  HOST DEVICE inline void operator=(const SQLTypeInfo& rhs) {
588  type = rhs.get_type();
589  subtype = rhs.get_subtype();
590  dimension = rhs.get_dimension();
591  scale = rhs.get_scale();
592  notnull = rhs.get_notnull();
594  comp_param = rhs.get_comp_param();
595  size = rhs.get_size();
596  }
597 
598  inline bool is_castable(const SQLTypeInfo& new_type_info) const {
599  // can always cast between the same type but different precision/scale/encodings
600  if (type == new_type_info.get_type()) {
601  return true;
602  // can always cast from or to string
603  } else if (is_string() || new_type_info.is_string()) {
604  return true;
605  // can cast between numbers
606  } else if (is_number() && new_type_info.is_number()) {
607  return true;
608  // can cast from timestamp or date to number (epoch)
609  } else if ((type == kTIMESTAMP || type == kDATE) && new_type_info.is_number()) {
610  return true;
611  // can cast from date to timestamp
612  } else if (type == kDATE && new_type_info.get_type() == kTIMESTAMP) {
613  return true;
614  } else if (type == kTIMESTAMP && new_type_info.get_type() == kDATE) {
615  return true;
616  } else if (type == kBOOLEAN && new_type_info.is_number()) {
617  return true;
618  } else if (type == kARRAY && new_type_info.get_type() == kARRAY) {
619  return get_elem_type().is_castable(new_type_info.get_elem_type());
620  } else if (type == kCOLUMN && new_type_info.get_type() == kCOLUMN) {
621  return get_elem_type().is_castable(new_type_info.get_elem_type());
622  } else if (type == kCOLUMN_LIST && new_type_info.get_type() == kCOLUMN_LIST) {
623  return get_elem_type().is_castable(new_type_info.get_elem_type());
624  } else {
625  return false;
626  }
627  }
628 
637  inline bool is_numeric_scalar_auto_castable(const SQLTypeInfo& new_type_info) const {
638  const auto& new_type = new_type_info.get_type();
639  switch (type) {
640  case kBOOLEAN:
641  return new_type == kBOOLEAN;
642  case kTINYINT:
643  case kSMALLINT:
644  case kINT:
645  if (!new_type_info.is_number()) {
646  return false;
647  }
648  if (new_type_info.is_fp()) {
649  // We can lose precision here, but preserving existing behavior
650  return true;
651  }
652  return new_type_info.get_logical_size() >= get_logical_size();
653  case kBIGINT:
654  return new_type == kBIGINT || new_type == kDOUBLE;
655  case kFLOAT:
656  case kDOUBLE:
657  if (!new_type_info.is_fp()) {
658  return false;
659  }
660  return (new_type_info.get_logical_size() >= get_logical_size());
661  case kDECIMAL:
662  case kNUMERIC:
663  switch (new_type) {
664  case kDECIMAL:
665  case kNUMERIC:
666  return new_type_info.get_dimension() >= get_dimension();
667  case kDOUBLE:
668  return true;
669  case kFLOAT:
670  return get_dimension() <= 7;
671  default:
672  return false;
673  }
674  case kTIMESTAMP:
675  if (new_type != kTIMESTAMP) {
676  return false;
677  }
678  return new_type_info.get_dimension() >= get_dimension();
679  case kDATE:
680  return new_type == kDATE;
681  case kTIME:
682  return new_type == kTIME;
683  default:
684  UNREACHABLE();
685  return false;
686  }
687  }
688 
698  inline int32_t get_numeric_scalar_scale() const {
699  CHECK(type == kBOOLEAN || type == kTINYINT || type == kSMALLINT || type == kINT ||
700  type == kBIGINT || type == kFLOAT || type == kDOUBLE || type == kDECIMAL ||
701  type == kNUMERIC || type == kTIMESTAMP || type == kDATE || type == kTIME);
702  switch (type) {
703  case kBOOLEAN:
704  return 1;
705  case kTINYINT:
706  case kSMALLINT:
707  case kINT:
708  case kBIGINT:
709  case kFLOAT:
710  case kDOUBLE:
711  return get_logical_size();
712  case kDECIMAL:
713  case kNUMERIC:
714  if (get_dimension() > 7) {
715  return 8;
716  } else {
717  return 4;
718  }
719  case kTIMESTAMP:
720  switch (get_dimension()) {
721  case 9:
722  return 8;
723  case 6:
724  return 4;
725  case 3:
726  return 2;
727  case 0:
728  return 1;
729  default:
730  UNREACHABLE();
731  }
732  case kDATE:
733  return 1;
734  case kTIME:
735  return 1;
736  default:
737  UNREACHABLE();
738  return 0;
739  }
740  }
741 
742  HOST DEVICE inline bool is_null(const Datum& d) const {
743  // assuming Datum is always uncompressed
744  switch (type) {
745  case kBOOLEAN:
746  return (int8_t)d.boolval == NULL_BOOLEAN;
747  case kTINYINT:
748  return d.tinyintval == NULL_TINYINT;
749  case kSMALLINT:
750  return d.smallintval == NULL_SMALLINT;
751  case kINT:
752  return d.intval == NULL_INT;
753  case kBIGINT:
754  case kNUMERIC:
755  case kDECIMAL:
756  return d.bigintval == NULL_BIGINT;
757  case kFLOAT:
758  return d.floatval == NULL_FLOAT;
759  case kDOUBLE:
760  return d.doubleval == NULL_DOUBLE;
761  case kTIME:
762  case kTIMESTAMP:
763  case kDATE:
764  return d.bigintval == NULL_BIGINT;
765  case kTEXT:
766  case kVARCHAR:
767  case kCHAR:
768  // @TODO handle null strings
769  break;
770  case kNULLT:
771  return true;
772  case kARRAY:
773  return d.arrayval == NULL || d.arrayval->is_null;
774  default:
775  break;
776  }
777  return false;
778  }
779  HOST DEVICE inline bool is_null(const int8_t* val) const {
780  if (type == kFLOAT) {
781  return *(float*)val == NULL_FLOAT;
782  }
783  if (type == kDOUBLE) {
784  return *(double*)val == NULL_DOUBLE;
785  }
786  // val can be either compressed or uncompressed
787  switch (size) {
788  case 1:
789  return *val == NULL_TINYINT;
790  case 2:
791  return *(int16_t*)val == NULL_SMALLINT;
792  case 4:
793  return *(int32_t*)val == NULL_INT;
794  case 8:
795  return *(int64_t*)val == NULL_BIGINT;
796  case kNULLT:
797  return true;
798  default:
799  // @TODO(wei) handle null strings
800  break;
801  }
802  return false;
803  }
804  HOST DEVICE inline bool is_null_fixlen_array(const int8_t* val, int array_size) const {
805  // Check if fixed length array has a NULL_ARRAY sentinel as the first element
806  if (type == kARRAY && val && array_size > 0 && array_size == size) {
807  // Need to create element type to get the size, but can't call get_elem_type()
808  // since this is a HOST DEVICE function. Going through copy constructor instead.
809  auto elem_ti{*this};
810  elem_ti.set_type(subtype);
811  elem_ti.set_subtype(kNULLT);
812  auto elem_size = elem_ti.get_storage_size();
813  if (elem_size < 1) {
814  return false;
815  }
816  if (subtype == kFLOAT) {
817  return *(float*)val == NULL_ARRAY_FLOAT;
818  }
819  if (subtype == kDOUBLE) {
820  return *(double*)val == NULL_ARRAY_DOUBLE;
821  }
822  switch (elem_size) {
823  case 1:
824  return *val == NULL_ARRAY_TINYINT;
825  case 2:
826  return *(int16_t*)val == NULL_ARRAY_SMALLINT;
827  case 4:
828  return *(int32_t*)val == NULL_ARRAY_INT;
829  case 8:
830  return *(int64_t*)val == NULL_ARRAY_BIGINT;
831  default:
832  return false;
833  }
834  }
835  return false;
836  }
837  HOST DEVICE inline bool is_null_point_coord_array(const int8_t* val,
838  int array_size) const {
839  if (type == kARRAY && subtype == kTINYINT && val && array_size > 0 &&
840  array_size == size) {
841  if (array_size == 2 * sizeof(double)) {
842  return *(double*)val == NULL_ARRAY_DOUBLE;
843  }
844  if (array_size == 2 * sizeof(int32_t)) {
845  return *(uint32_t*)val == NULL_ARRAY_COMPRESSED_32;
846  }
847  }
848  return false;
849  }
850  inline SQLTypeInfo get_elem_type() const {
851  return SQLTypeInfo(
853  }
854  inline SQLTypeInfo get_array_type() const {
856  }
857 
858  inline bool is_date_in_days() const {
859  if (type == kDATE) {
860  const auto comp_type = get_compression();
861  if (comp_type == kENCODING_DATE_IN_DAYS) {
862  return true;
863  }
864  }
865  return false;
866  }
867 
868  inline bool is_date() const { return type == kDATE; }
869 
870  inline bool is_high_precision_timestamp() const {
871  if (type == kTIMESTAMP) {
872  const auto dimension = get_dimension();
873  if (dimension > 0) {
874  return true;
875  }
876  }
877  return false;
878  }
879 
880  inline bool is_timestamp() const { return type == kTIMESTAMP; }
881 
882  private:
883  SQLTypes type; // type id
884  SQLTypes subtype; // element type of arrays or columns
885  int dimension; // VARCHAR/CHAR length or NUMERIC/DECIMAL precision or COLUMN_LIST
886  // length
887  int scale; // NUMERIC/DECIMAL scale
888  bool notnull; // nullable? a hint, not used for type checking
889  EncodingType compression; // compression scheme
890  int comp_param; // compression parameter when applicable for certain schemes
891  int size; // size of the type in bytes. -1 for variable size
892 #ifndef __CUDACC__
893  static std::string type_name[kSQLTYPE_LAST];
894  static std::string comp_name[kENCODING_LAST];
895 #endif
896  HOST DEVICE inline int get_storage_size() const {
897  switch (type) {
898  case kBOOLEAN:
899  return sizeof(int8_t);
900  case kTINYINT:
901  return sizeof(int8_t);
902  case kSMALLINT:
903  switch (compression) {
904  case kENCODING_NONE:
905  return sizeof(int16_t);
906  case kENCODING_FIXED:
907  case kENCODING_SPARSE:
908  return comp_param / 8;
909  case kENCODING_RL:
910  case kENCODING_DIFF:
911  break;
912  default:
913  assert(false);
914  }
915  break;
916  case kINT:
917  switch (compression) {
918  case kENCODING_NONE:
919  return sizeof(int32_t);
920  case kENCODING_FIXED:
921  case kENCODING_SPARSE:
922  case kENCODING_GEOINT:
923  return comp_param / 8;
924  case kENCODING_RL:
925  case kENCODING_DIFF:
926  break;
927  default:
928  assert(false);
929  }
930  break;
931  case kBIGINT:
932  case kNUMERIC:
933  case kDECIMAL:
934  switch (compression) {
935  case kENCODING_NONE:
936  return sizeof(int64_t);
937  case kENCODING_FIXED:
938  case kENCODING_SPARSE:
939  return comp_param / 8;
940  case kENCODING_RL:
941  case kENCODING_DIFF:
942  break;
943  default:
944  assert(false);
945  }
946  break;
947  case kFLOAT:
948  switch (compression) {
949  case kENCODING_NONE:
950  return sizeof(float);
951  case kENCODING_FIXED:
952  case kENCODING_RL:
953  case kENCODING_DIFF:
954  case kENCODING_SPARSE:
955  assert(false);
956  break;
957  default:
958  assert(false);
959  }
960  break;
961  case kDOUBLE:
962  switch (compression) {
963  case kENCODING_NONE:
964  return sizeof(double);
965  case kENCODING_FIXED:
966  case kENCODING_RL:
967  case kENCODING_DIFF:
968  case kENCODING_SPARSE:
969  assert(false);
970  break;
971  default:
972  assert(false);
973  }
974  break;
975  case kTIMESTAMP:
976  case kTIME:
977  case kINTERVAL_DAY_TIME:
979  case kDATE:
980  switch (compression) {
981  case kENCODING_NONE:
982  return sizeof(int64_t);
983  case kENCODING_FIXED:
984  if (type == kTIMESTAMP && dimension > 0) {
985  assert(false); // disable compression for timestamp precisions
986  }
987  return comp_param / 8;
988  case kENCODING_RL:
989  case kENCODING_DIFF:
990  case kENCODING_SPARSE:
991  assert(false);
992  break;
994  switch (comp_param) {
995  case 0:
996  return 4; // Default date encoded in days is 32 bits
997  case 16:
998  case 32:
999  return comp_param / 8;
1000  default:
1001  assert(false);
1002  break;
1003  }
1004  default:
1005  assert(false);
1006  }
1007  break;
1008  case kTEXT:
1009  case kVARCHAR:
1010  case kCHAR:
1011  if (compression == kENCODING_DICT) {
1012  return sizeof(int32_t); // @TODO(wei) must check DictDescriptor
1013  }
1014  break;
1015  case kARRAY:
1016  // TODO: return size for fixlen arrays?
1017  break;
1018  case kPOINT:
1019  case kLINESTRING:
1020  case kPOLYGON:
1021  case kMULTIPOLYGON:
1022  case kCOLUMN:
1023  case kCOLUMN_LIST:
1024  break;
1025  default:
1026  break;
1027  }
1028  return -1;
1029  }
1030 };
1031 
1033 
1034 #ifndef __CUDACC__
1035 #include <string_view>
1036 
1037 Datum StringToDatum(std::string_view s, SQLTypeInfo& ti);
1038 std::string DatumToString(Datum d, const SQLTypeInfo& ti);
1039 bool DatumEqual(const Datum, const Datum, const SQLTypeInfo& ti);
1040 int64_t convert_decimal_value_to_scale(const int64_t decimal_value,
1041  const SQLTypeInfo& type_info,
1042  const SQLTypeInfo& new_type_info);
1043 #endif
1044 
1045 #include "../QueryEngine/DateAdd.h"
1046 #include "../QueryEngine/DateTruncate.h"
1047 #include "../QueryEngine/ExtractFromTime.h"
1048 
1050  EncodingType encoding = type_info.get_compression();
1051  if (encoding == kENCODING_DATE_IN_DAYS ||
1052  (encoding == kENCODING_FIXED && type_info.get_type() != kARRAY)) {
1053  encoding = kENCODING_NONE;
1054  }
1055  return SQLTypeInfo(type_info.get_type(),
1056  type_info.get_dimension(),
1057  type_info.get_scale(),
1058  type_info.get_notnull(),
1059  encoding,
1060  type_info.get_comp_param(),
1061  type_info.get_subtype());
1062 }
1063 
1065  SQLTypeInfo nullable_type_info = type_info;
1066  nullable_type_info.set_notnull(false);
1067  return nullable_type_info;
1068 }
1069 
1071  SQLTypeInfo nullable_type_info = get_logical_type_info(type_info);
1072  return get_nullable_type_info(nullable_type_info);
1073 }
1074 
1075 using StringOffsetT = int32_t;
1076 using ArrayOffsetT = int32_t;
1077 
1078 inline int8_t* appendDatum(int8_t* buf, Datum d, const SQLTypeInfo& ti) {
1079  switch (ti.get_type()) {
1080  case kBOOLEAN:
1081  *(int8_t*)buf = d.boolval;
1082  return buf + sizeof(int8_t);
1083  case kNUMERIC:
1084  case kDECIMAL:
1085  case kBIGINT:
1086  *(int64_t*)buf = d.bigintval;
1087  return buf + sizeof(int64_t);
1088  case kINT:
1089  *(int32_t*)buf = d.intval;
1090  return buf + sizeof(int32_t);
1091  case kSMALLINT:
1092  *(int16_t*)buf = d.smallintval;
1093  return buf + sizeof(int16_t);
1094  case kTINYINT:
1095  *(int8_t*)buf = d.tinyintval;
1096  return buf + sizeof(int8_t);
1097  case kFLOAT:
1098  *(float*)buf = d.floatval;
1099  return buf + sizeof(float);
1100  case kDOUBLE:
1101  *(double*)buf = d.doubleval;
1102  return buf + sizeof(double);
1103  case kTIME:
1104  case kTIMESTAMP:
1105  case kDATE:
1106  *reinterpret_cast<int64_t*>(buf) = d.bigintval;
1107  return buf + sizeof(int64_t);
1108  default:
1109  return nullptr;
1110  }
1111 }
1112 
1113 inline auto generate_array_type(const SQLTypes subtype) {
1114  auto ti = SQLTypeInfo(kARRAY, false);
1115  ti.set_subtype(subtype);
1116  return ti;
1117 }
1118 
1119 inline auto generate_column_type(const SQLTypes subtype) {
1120  auto ti = SQLTypeInfo(kCOLUMN, false);
1121  ti.set_subtype(subtype);
1122  return ti;
1123 }
1124 
1125 inline auto generate_column_type(const SQLTypes subtype, EncodingType c, int p) {
1126  auto ti = SQLTypeInfo(kCOLUMN, false);
1127  ti.set_subtype(subtype);
1128  ti.set_compression(c);
1129  ti.set_comp_param(p);
1130  return ti;
1131 }
1132 
1133 inline auto generate_column_list_type(const SQLTypes subtype) {
1134  auto ti = SQLTypeInfo(kCOLUMN_LIST, false);
1135  ti.set_subtype(subtype);
1136  return ti;
1137 }
int8_t tinyintval
Definition: sqltypes.h:212
HOST DEVICE SQLTypes get_subtype() const
Definition: sqltypes.h:330
void set_compression(EncodingType c)
Definition: sqltypes.h:429
void set_size(int s)
Definition: sqltypes.h:427
#define NULL_DOUBLE
HOST DEVICE int get_size() const
Definition: sqltypes.h:339
HOST DEVICE void operator=(const SQLTypeInfo &rhs)
Definition: sqltypes.h:587
std::string DatumToString(Datum d, const SQLTypeInfo &ti)
Definition: Datum.cpp:392
bool is_varlen_array() const
Definition: sqltypes.h:518
DEVICE VarlenDatum()
Definition: sqltypes.h:155
std::string toString(const ExtArgumentType &sig_type)
Definition: sqltypes.h:49
DEVICE constexpr bool is_cuda_compiler()
Definition: sqltypes.h:199
SQLTypes
Definition: sqltypes.h:38
std::vector< std::string > * stringsPtr
Definition: sqltypes.h:227
bool is_timestamp() const
Definition: sqltypes.h:880
std::vector< ArrayDatum > * arraysPtr
Definition: sqltypes.h:228
#define NULL_ARRAY_INT
#define NULL_FLOAT
bool is_null
Definition: sqltypes.h:153
#define NULL_BIGINT
SQLTypeInfo get_nullable_logical_type_info(const SQLTypeInfo &type_info)
Definition: sqltypes.h:1070
#define LOG(tag)
Definition: Logger.h:203
HOST DEVICE bool operator==(const SQLTypeInfo &rhs) const
Definition: sqltypes.h:567
std::ostream & operator<<(std::ostream &os, const SessionInfo &session_info)
Definition: SessionInfo.cpp:57
bool is_fp() const
Definition: sqltypes.h:513
HOST DEVICE int get_scale() const
Definition: sqltypes.h:334
bool is_varlen() const
Definition: sqltypes.h:534
#define NULL_ARRAY_SMALLINT
auto generate_column_type(const SQLTypes subtype)
Definition: sqltypes.h:1119
int8_t boolval
Definition: sqltypes.h:211
std::string get_compression_name() const
Definition: sqltypes.h:470
std::string concat(Types &&...parms)
VarlenDatum * arrayval
Definition: sqltypes.h:218
#define UNREACHABLE()
Definition: Logger.h:253
HOST DEVICE void set_subtype(SQLTypes st)
Definition: sqltypes.h:420
SQLTypeInfo(SQLTypes t, int d, int s)
Definition: sqltypes.h:299
SQLTypeInfo get_logical_type_info(const SQLTypeInfo &type_info)
Definition: sqltypes.h:1049
Definition: sqltypes.h:65
#define NULL_ARRAY_TINYINT
HOST DEVICE bool is_null_fixlen_array(const int8_t *val, int array_size) const
Definition: sqltypes.h:804
HOST DEVICE SQLTypes get_type() const
Definition: sqltypes.h:329
bool is_number() const
Definition: sqltypes.h:514
int32_t intval
Definition: sqltypes.h:214
bool is_time() const
Definition: sqltypes.h:515
std::string to_string(char const *&&v)
HostArrayDatum(size_t const l, int8_t *p, bool const n, CUSTOM_DELETER custom_deleter)
Definition: sqltypes.h:189
int8_t * pointer
Definition: sqltypes.h:152
#define NULL_INT
int32_t StringOffsetT
Definition: sqltypes.h:1075
bool has_render_group() const
Definition: sqltypes.h:409
#define DEVICE
std::conditional_t< is_cuda_compiler(), DeviceArrayDatum, HostArrayDatum > ArrayDatum
Definition: sqltypes.h:208
#define HOST
void set_input_srid(int d)
Definition: sqltypes.h:423
float floatval
Definition: sqltypes.h:216
std::string to_string() const
Definition: sqltypes.h:472
EncodingType
Definition: sqltypes.h:233
int get_physical_cols() const
Definition: sqltypes.h:350
bool is_fixlen_array() const
Definition: sqltypes.h:519
bool is_castable(const SQLTypeInfo &new_type_info) const
Definition: sqltypes.h:598
#define IS_INTERVAL(T)
Definition: sqltypes.h:253
void set_fixed_size()
Definition: sqltypes.h:428
std::shared_ptr< int8_t > ManagedPtr
Definition: sqltypes.h:170
HOST DEVICE bool operator!=(const SQLTypeInfo &rhs) const
Definition: sqltypes.h:559
int get_logical_size() const
Definition: sqltypes.h:340
bool DatumEqual(const Datum a, const Datum b, const SQLTypeInfo &ti)
Definition: Datum.cpp:342
static std::string type_name[kSQLTYPE_LAST]
Definition: sqltypes.h:893
bool is_integer() const
Definition: sqltypes.h:511
VarlenDatum(const size_t l, int8_t *p, const bool n)
Definition: sqltypes.h:158
bool is_subtype_dict_encoded_string() const
Definition: sqltypes.h:550
#define NULL_ARRAY_COMPRESSED_32
SQLTypes subtype
Definition: sqltypes.h:884
void set_scale(int s)
Definition: sqltypes.h:424
bool notnull
Definition: sqltypes.h:888
bool has_bounds() const
Definition: sqltypes.h:398
int64_t bigintval
Definition: sqltypes.h:215
HostArrayDatum(size_t const l, int8_t *p, CUSTOM_DELETER custom_deleter)
Definition: sqltypes.h:183
bool is_timeinterval() const
Definition: sqltypes.h:520
#define NULL_ARRAY_FLOAT
bool is_numeric_scalar_auto_castable(const SQLTypeInfo &new_type_info) const
returns true if the sql_type can be cast to the type specified by new_type_info with no loss of preci...
Definition: sqltypes.h:637
ManagedPtr data_ptr
Definition: sqltypes.h:192
auto generate_column_list_type(const SQLTypes subtype)
Definition: sqltypes.h:1133
HostArrayDatum()=default
int16_t smallintval
Definition: sqltypes.h:213
bool is_dict_encoded_type() const
Definition: sqltypes.h:554
SQLTypeInfo(SQLTypes t, int d, int s, bool n)
Definition: sqltypes.h:281
Datum StringToDatum(std::string_view s, SQLTypeInfo &ti)
Definition: Datum.cpp:275
std::string toString() const
Definition: sqltypes.h:471
bool is_boolean() const
Definition: sqltypes.h:516
HostArrayDatum(size_t const l, int8_t *p, bool const n)
Definition: sqltypes.h:177
bool g_enable_smem_group_by true
void operator()(int8_t *p)
Definition: sqltypes.h:166
SQLTypeInfo(SQLTypes t, int d, int s, bool n, EncodingType c, int p, SQLTypes st)
Definition: sqltypes.h:272
SQLTypeInfo(SQLTypes t)
Definition: sqltypes.h:309
#define NULL_BOOLEAN
std::string get_buffer_name() const
Definition: sqltypes.h:493
SQLTypeInfo(SQLTypes t, bool n, EncodingType c)
Definition: sqltypes.h:310
SQLTypeInfo get_array_type() const
Definition: sqltypes.h:854
EncodingType compression
Definition: sqltypes.h:889
int get_precision() const
Definition: sqltypes.h:332
std::string * stringval
Definition: sqltypes.h:220
void set_output_srid(int s)
Definition: sqltypes.h:425
bool is_buffer() const
Definition: sqltypes.h:527
SQLTypes decimal_to_int_type(const SQLTypeInfo &ti)
Definition: Datum.cpp:455
auto generate_array_type(const SQLTypes subtype)
Definition: sqltypes.h:1113
bool is_column() const
Definition: sqltypes.h:522
DEVICE DeviceArrayDatum()
Definition: sqltypes.h:196
HOST DEVICE bool is_null(const Datum &d) const
Definition: sqltypes.h:742
void set_comp_param(int p)
Definition: sqltypes.h:430
HOST DEVICE int get_storage_size() const
Definition: sqltypes.h:896
#define CHECK_LT(x, y)
Definition: Logger.h:219
Definition: sqltypes.h:52
Definition: sqltypes.h:53
static std::string comp_name[kENCODING_LAST]
Definition: sqltypes.h:894
int8_t * appendDatum(int8_t *buf, Datum d, const SQLTypeInfo &ti)
Definition: sqltypes.h:1078
HOST DEVICE EncodingType get_compression() const
Definition: sqltypes.h:337
bool is_date_in_days() const
Definition: sqltypes.h:858
int get_array_context_logical_size() const
Definition: sqltypes.h:576
int64_t convert_decimal_value_to_scale(const int64_t decimal_value, const SQLTypeInfo &type_info, const SQLTypeInfo &new_type_info)
Definition: Datum.cpp:473
int32_t ArrayOffsetT
Definition: sqltypes.h:1076
void set_dimension(int d)
Definition: sqltypes.h:421
HOST DEVICE int get_dimension() const
Definition: sqltypes.h:331
#define IS_INTEGER(T)
Definition: sqltypes.h:245
std::string get_type_name() const
Definition: sqltypes.h:432
int32_t get_numeric_scalar_scale() const
returns integer between 1 and 8 indicating what is roughly equivalent to the logical byte size of a s...
Definition: sqltypes.h:698
Definition: sqltypes.h:41
#define IS_STRING(T)
Definition: sqltypes.h:250
HOST DEVICE int get_comp_param() const
Definition: sqltypes.h:338
HOST DEVICE int get_input_srid() const
Definition: sqltypes.h:333
#define NULL_TINYINT
#define NULL_ARRAY_DOUBLE
virtual DEVICE ~VarlenDatum()
Definition: sqltypes.h:156
bool is_bytes() const
Definition: sqltypes.h:524
bool is_column_list() const
Definition: sqltypes.h:523
bool g_enable_watchdog false
Definition: Execute.cpp:76
void set_notnull(bool n)
Definition: sqltypes.h:426
#define CHECK(condition)
Definition: Logger.h:209
bool is_geometry() const
Definition: sqltypes.h:521
char * t
bool is_high_precision_timestamp() const
Definition: sqltypes.h:870
SQLTypes type
Definition: sqltypes.h:883
#define NULL_SMALLINT
HostArrayDatum(size_t const l, ManagedPtr p, bool const n)
Definition: sqltypes.h:174
#define NULL_ARRAY_BIGINT
bool is_dict_encoded_string() const
Definition: sqltypes.h:546
Definition: sqltypes.h:45
bool is_varlen_indeed() const
Definition: sqltypes.h:540
bool is_string() const
Definition: sqltypes.h:509
SQLTypeInfo(SQLTypes t, EncodingType c, int p, SQLTypes st)
Definition: sqltypes.h:290
constexpr double n
Definition: Utm.h:46
bool transforms() const
Definition: sqltypes.h:530
SQLTypeInfo(SQLTypes t, bool n)
Definition: sqltypes.h:300
HOST DEVICE bool get_notnull() const
Definition: sqltypes.h:336
int8_t * numbersPtr
Definition: sqltypes.h:226
bool is_string_array() const
Definition: sqltypes.h:510
SQLTypeInfo get_elem_type() const
Definition: sqltypes.h:850
bool is_decimal() const
Definition: sqltypes.h:512
int get_physical_coord_cols() const
Definition: sqltypes.h:365
#define IS_NUMBER(T)
Definition: sqltypes.h:247
void operator()(int8_t *)
Definition: sqltypes.h:163
#define IS_GEO(T)
Definition: sqltypes.h:251
#define TRANSIENT_DICT(ID)
Definition: sqltypes.h:260
int comp_param
Definition: sqltypes.h:890
bool is_date() const
Definition: sqltypes.h:868
bool is_array() const
Definition: sqltypes.h:517
void set_precision(int d)
Definition: sqltypes.h:422
SQLTypeInfo get_nullable_type_info(const SQLTypeInfo &type_info)
Definition: sqltypes.h:1064
int dimension
Definition: sqltypes.h:885
HOST DEVICE bool is_null_point_coord_array(const int8_t *val, int array_size) const
Definition: sqltypes.h:837
double doubleval
Definition: sqltypes.h:217
HOST DEVICE int get_output_srid() const
Definition: sqltypes.h:335
constexpr auto is_datetime(SQLTypes type)
Definition: sqltypes.h:263
HOST DEVICE bool is_null(const int8_t *val) const
Definition: sqltypes.h:779
size_t length
Definition: sqltypes.h:151
HOST DEVICE void set_type(SQLTypes t)
Definition: sqltypes.h:419