OmniSciDB  cde582ebc3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
heavydbTypes.h
Go to the documentation of this file.
1 /*
2  * Copyright 2022 HEAVY.AI, 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 
17 #pragma once
18 
19 #include <cstring>
20 #include <limits>
21 #include <stdexcept>
22 #include <type_traits>
23 
24 #include "DateTruncate.h"
25 #include "ExtractFromTime.h"
26 
27 #if !(defined(__CUDACC__) || defined(NO_BOOST))
28 #include "../Shared/DateTimeParser.h"
29 #endif
30 
31 /* `../` is required for UDFCompiler */
32 #include "../Shared/InlineNullValues.h"
33 #include "../Shared/funcannotations.h"
34 
35 #ifndef __CUDACC__
36 #ifndef UDF_COMPILED
37 #include "../StringDictionary/StringDictionaryProxy.h"
38 #endif // #ifndef UDF_COMPILED
39 #endif // #ifndef __CUDACC__
40 
41 // declaring CPU functions as __host__ can help catch erroneous compilation of
42 // these being done by the CUDA compiler at build time
43 #define EXTENSION_INLINE_HOST extern "C" RUNTIME_EXPORT ALWAYS_INLINE HOST
44 #define EXTENSION_NOINLINE_HOST extern "C" RUNTIME_EXPORT NEVER_INLINE HOST
45 
46 #define EXTENSION_INLINE extern "C" RUNTIME_EXPORT ALWAYS_INLINE DEVICE
47 #define EXTENSION_NOINLINE extern "C" RUNTIME_EXPORT NEVER_INLINE DEVICE
48 #define TEMPLATE_INLINE ALWAYS_INLINE DEVICE
49 #define TEMPLATE_NOINLINE NEVER_INLINE DEVICE
50 
51 EXTENSION_NOINLINE int8_t* allocate_varlen_buffer(int64_t element_count,
52  int64_t element_size);
53 
54 /*
55  Table function management functions and macros:
56  */
57 #define FUNC_NAME (std::string(__func__).substr(0, std::string(__func__).find("__")))
58 // TODO: support windows path format
59 #define ERROR_STRING(MSG) \
60  (std::string(__FILE__).substr(std::string(__FILE__).rfind("/") + 1) + ":" + \
61  std::to_string(__LINE__) + " " + FUNC_NAME + ": " + MSG) \
62  .c_str()
63 #define TABLE_FUNCTION_ERROR(MSG) table_function_error(ERROR_STRING(MSG))
64 #define ERROR_MESSAGE(MSG) error_message(ERROR_STRING(MSG))
65 
66 EXTENSION_NOINLINE_HOST void set_output_row_size(int64_t num_rows);
68  int64_t num_rows);
70 EXTENSION_NOINLINE_HOST int32_t table_function_error(const char* message);
72  const char* message);
73 
74 // https://www.fluentcpp.com/2018/04/06/strong-types-by-struct/
76  int32_t value;
77 
78 #ifndef __CUDACC__
79  TextEncodingDict(const int32_t other) : value(other) {}
81 #endif
82 
83  operator int32_t() const { return value; }
84 
85  TextEncodingDict operator=(const int32_t other) {
86  value = other;
87  return *this;
88  }
89 
90  DEVICE ALWAYS_INLINE bool operator==(const TextEncodingDict& other) const {
91  return value == other.value;
92  }
93 
94  DEVICE ALWAYS_INLINE bool operator==(const int32_t& other) const {
95  return value == other;
96  }
97 
98  DEVICE ALWAYS_INLINE bool operator==(const int64_t& other) const {
99  return value == other;
100  }
101 
102  DEVICE ALWAYS_INLINE bool operator!=(const TextEncodingDict& other) const {
103  return !operator==(other);
104  }
105  DEVICE ALWAYS_INLINE bool operator!=(const int32_t& other) const {
106  return !operator==(other);
107  }
108 
109  DEVICE ALWAYS_INLINE bool operator!=(const int64_t& other) const {
110  return !operator==(other);
111  }
112 
113  DEVICE ALWAYS_INLINE bool operator<(const TextEncodingDict& other) const {
114  return value < other.value;
115  }
116 
117  DEVICE ALWAYS_INLINE bool operator<(const int32_t& other) const {
118  return value < other;
119  }
120 
121  DEVICE ALWAYS_INLINE bool operator<(const int64_t& other) const {
122  return value < other;
123  }
124 };
125 
126 template <>
128 #ifndef __CUDACC__
129  return TextEncodingDict(inline_int_null_value<int32_t>());
130 #else
131  TextEncodingDict null_val;
132  null_val.value = inline_int_null_value<int32_t>();
133  return null_val;
134 #endif
135 }
136 
137 template <typename T>
138 struct Array {
139  T* ptr;
140  int64_t size;
141  int8_t is_null;
142 
143  DEVICE Array(const int64_t size, const bool is_null = false)
144  : size(size), is_null(is_null) {
145  if (!is_null) {
146  ptr = reinterpret_cast<T*>(
147  allocate_varlen_buffer(size, static_cast<int64_t>(sizeof(T))));
148  } else {
149  ptr = nullptr;
150  }
151  }
152 
153  DEVICE T operator()(const unsigned int index) const {
154  if (index < static_cast<unsigned int>(size)) {
155  return ptr[index];
156  } else {
157  return 0; // see array_at
158  }
159  }
160 
161  DEVICE T& operator[](const unsigned int index) { return ptr[index]; }
162 
163  DEVICE int64_t getSize() const { return size; }
164 
165  DEVICE bool isNull() const { return is_null; }
166 
167  DEVICE constexpr inline T null_value() const {
168  return std::is_signed<T>::value ? std::numeric_limits<T>::min()
169  : std::numeric_limits<T>::max();
170  }
171 };
172 
174  char* ptr_;
175  int64_t size_;
176 
177 #ifndef __CUDACC__
178  TextEncodingNone() = default;
179  TextEncodingNone(const std::string& str) {
180  // Note this will only be valid for the
181  // lifetime of the string
182  ptr_ = const_cast<char*>(str.data());
183  size_ = str.length();
184  }
185  operator std::string() const { return std::string(ptr_, size_); }
186  std::string getString() const { return std::string(ptr_, size_); }
187 #endif
188 
189  DEVICE ALWAYS_INLINE char& operator[](const unsigned int index) {
190  return index < size_ ? ptr_[index] : ptr_[size_ - 1];
191  }
192  DEVICE ALWAYS_INLINE bool operator==(const char* rhs) const {
193 #ifdef __CUDACC__
194  for (int i = 0; i < size_; i++) {
195  if (rhs[i] == '\0' || ptr_[i] != rhs[i]) {
196  return false;
197  }
198  }
199  return rhs[size_] == '\0';
200 #else
201  return strcmp(ptr_, rhs) == 0;
202 #endif
203  }
204  DEVICE ALWAYS_INLINE bool operator!=(const char* rhs) const {
205  return !(this->operator==(rhs));
206  }
207  DEVICE ALWAYS_INLINE operator char*() const { return ptr_; }
208  DEVICE ALWAYS_INLINE int64_t size() const { return size_; }
209  DEVICE ALWAYS_INLINE bool isNull() const { return size_ == 0; }
210 };
211 
212 struct Timestamp {
213  int64_t time;
214 
215  Timestamp() = default;
216 
217  DEVICE Timestamp(int64_t timeval) : time(timeval) {}
218 
219 #if !(defined(__CUDACC__) || defined(NO_BOOST))
220  DEVICE Timestamp(std::string_view const str) {
221  time = dateTimeParse<kTIMESTAMP>(str, 9);
222  }
223 #endif
224 
225  DEVICE ALWAYS_INLINE const Timestamp operator+(const Timestamp& other) const {
226 #ifndef __CUDACC__
227  if (other.time > 0) {
228  if (time > (std::numeric_limits<int64_t>::max() - other.time)) {
229  throw std::underflow_error("Underflow in Timestamp addition!");
230  }
231  } else {
232  if (time < (std::numeric_limits<int64_t>::min() - other.time)) {
233  throw std::overflow_error("Overflow in Timestamp addition!");
234  }
235  }
236 #endif
237  return Timestamp(time + other.time);
238  }
239 
240  DEVICE ALWAYS_INLINE const Timestamp operator-(const Timestamp& other) const {
241 #ifndef __CUDACC__
242  if (other.time > 0) {
243  if (time < (std::numeric_limits<int64_t>::min() + other.time)) {
244  throw std::underflow_error("Underflow in Timestamp substraction!");
245  }
246  } else {
247  if (time > (std::numeric_limits<int64_t>::max() + other.time)) {
248  throw std::overflow_error("Overflow in Timestamp substraction!");
249  }
250  }
251 #endif
252  return Timestamp(time - other.time);
253  }
254 
255  DEVICE ALWAYS_INLINE int64_t operator/(const Timestamp& other) const {
256 #ifndef __CUDACC__
257  if (other.time == 0) {
258  throw std::runtime_error("Timestamp division by zero!");
259  }
260 #endif
261  return time / other.time;
262  }
263 
264  DEVICE ALWAYS_INLINE const Timestamp operator*(const int64_t multiplier) const {
265 #ifndef __CUDACC__
266  uint64_t overflow_test =
267  static_cast<uint64_t>(time) * static_cast<uint64_t>(multiplier);
268  if (time != 0 && overflow_test / time != static_cast<uint64_t>(multiplier)) {
269  throw std::runtime_error("Overflow in Timestamp multiplication!");
270  }
271 #endif
272  return Timestamp(time * multiplier);
273  }
274 
275  DEVICE ALWAYS_INLINE bool operator==(const Timestamp& other) const {
276  return time == other.time;
277  }
278 
279  DEVICE ALWAYS_INLINE bool operator!=(const Timestamp& other) const {
280  return !operator==(other);
281  }
282 
283  DEVICE ALWAYS_INLINE bool operator<(const Timestamp& other) const {
284  return time < other.time;
285  }
286 
289  }
290 
293  }
294 
297  }
298 
299 #ifndef __CUDACC__
302  }
303 
306  }
307 
310  }
311 
314  }
315 
318  }
319 
322  }
323  // Should always be safe as we're downcasting to lower precisions
326  }
327  // Should always be safe as we're downcasting to lower precisions
330  }
331  // Should always be safe as we're downcasting to lower precisions
332  DEVICE ALWAYS_INLINE int64_t getSeconds() const {
334  }
335  DEVICE ALWAYS_INLINE int64_t getMinutes() const {
337  }
338  DEVICE ALWAYS_INLINE int64_t getHours() const {
340  }
341  DEVICE ALWAYS_INLINE int64_t getDay() const {
343  }
344  DEVICE ALWAYS_INLINE int64_t getMonth() const {
346  }
347  DEVICE ALWAYS_INLINE int64_t getYear() const {
349  }
350 #endif
351 };
352 
353 template <>
355  return Timestamp(inline_int_null_value<int64_t>());
356 }
357 
358 struct GeoPoint {
359  int8_t* ptr;
360  int32_t sz;
361  int32_t compression;
362  int32_t input_srid;
363  int32_t output_srid;
364 
365  DEVICE int64_t getSize() const { return sz; }
366 
367  DEVICE int32_t getCompression() const { return compression; }
368 
369  DEVICE int32_t getInputSrid() const { return input_srid; }
370 
371  DEVICE int32_t getOutputSrid() const { return output_srid; }
372 };
373 
375  int8_t* ptr;
376  int32_t sz;
377  int32_t compression;
378  int32_t input_srid;
379  int32_t output_srid;
380 
381  DEVICE int32_t getSize() const { return sz; }
382 
383  DEVICE int32_t getCompression() const { return compression; }
384 
385  DEVICE int32_t getInputSrid() const { return input_srid; }
386 
387  DEVICE int32_t getOutputSrid() const { return output_srid; }
388 };
389 
390 struct GeoPolygon {
391  int8_t* ptr_coords;
392  int32_t coords_size;
393  int8_t* ring_sizes;
394  int32_t num_rings;
395  int32_t compression;
396  int32_t input_srid;
397  int32_t output_srid;
398 
399  DEVICE int8_t* getRingSizes() { return ring_sizes; }
400  DEVICE int32_t getCoordsSize() const { return coords_size; }
401 
402  DEVICE int32_t getNumRings() const { return num_rings; }
403 
404  DEVICE int32_t getCompression() const { return compression; }
405 
406  DEVICE int32_t getInputSrid() const { return input_srid; }
407 
408  DEVICE int32_t getOutputSrid() const { return output_srid; }
409 };
410 
412  int8_t* ptr_coords;
413  int32_t coords_size;
414  int8_t* ring_sizes;
415  int32_t num_rings;
416  int8_t* poly_sizes;
417  int32_t num_polys;
418  int32_t compression;
419  int32_t input_srid;
420  int32_t output_srid;
421 
422  DEVICE int8_t* getRingSizes() { return ring_sizes; }
423  DEVICE int32_t getCoordsSize() const { return coords_size; }
424 
425  DEVICE int32_t getNumRings() const { return num_rings; }
426 
427  DEVICE int8_t* getPolygonSizes() { return poly_sizes; }
428 
429  DEVICE int32_t getNumPolygons() const { return num_polys; }
430 
431  DEVICE int32_t getCompression() const { return compression; }
432 
433  DEVICE int32_t getInputSrid() const { return input_srid; }
434 
435  DEVICE int32_t getOutputSrid() const { return output_srid; }
436 };
437 
438 // There are redundant #ifndef UDF_COMPILED inside
439 // ifguard for StringDictionaryProxy to flag that
440 // if we decide to adapt C++ UDF Compiler for table
441 // functions, the linking issue we encountered with
442 // the shared_mutex include in StringDicitonaryProxy
443 // will need to be resolved separately.
444 
445 #ifndef UDF_COMPILED
446 
447 #ifdef __CUDACC__
448 template <typename T>
449 static DEVICE __constant__ T Column_null_value;
450 #endif
451 
452 template <typename T>
453 struct Column {
454  T* ptr_; // row data
455  int64_t size_; // row count
456 
457  DEVICE T& operator[](const unsigned int index) const {
458  if (index >= size_) {
459 #ifndef __CUDACC__
460  throw std::runtime_error("column buffer index is out of range");
461 #else
462  auto& null_value = Column_null_value<T>;
463  set_null(null_value);
464  return null_value;
465 #endif
466  }
467  return ptr_[index];
468  }
469  DEVICE int64_t size() const { return size_; }
470 
471  DEVICE inline bool isNull(int64_t index) const { return is_null(ptr_[index]); }
472  DEVICE inline void setNull(int64_t index) { set_null(ptr_[index]); }
474 #ifndef __CUDACC__
475  if (size() == other.size()) {
476  memcpy(ptr_, &other[0], other.size() * sizeof(T));
477  } else {
478  throw std::runtime_error("cannot copy assign columns with different sizes");
479  }
480 #else
481  if (size() == other.size()) {
482  for (unsigned int i = 0; i < size(); i++) {
483  ptr_[i] = other[i];
484  }
485  } else {
486  // TODO: set error
487  }
488 #endif
489  return *this;
490  }
491 
492 #ifdef HAVE_TOSTRING
493  std::string toString() const {
494  return ::typeName(this) + "(ptr=" + ::toString(reinterpret_cast<void*>(ptr_)) +
495  ", size=" + std::to_string(size_) + ")";
496  }
497 #endif
498 };
499 
500 template <>
502  TextEncodingDict* ptr_; // row data
503  int64_t size_; // row count
504 #ifndef __CUDACC__
505 #ifndef UDF_COMPILED
507 #endif // #ifndef UDF_COMPILED
508 #endif // #ifndef __CUDACC__
509 
510  DEVICE TextEncodingDict& operator[](const unsigned int index) const {
511  if (index >= size_) {
512 #ifndef __CUDACC__
513  throw std::runtime_error("column buffer index is out of range");
514 #else
515  static DEVICE TextEncodingDict null_value;
516  set_null(null_value.value);
517  return null_value;
518 #endif
519  }
520  return ptr_[index];
521  }
522  DEVICE int64_t size() const { return size_; }
523 
524  DEVICE inline bool isNull(int64_t index) const { return is_null(ptr_[index].value); }
525 
526  DEVICE inline void setNull(int64_t index) { set_null(ptr_[index].value); }
527 
528 #ifndef __CUDACC__
529 #ifndef UDF_COMPILED
530  DEVICE inline const std::string getString(int64_t index) const {
531  return isNull(index) ? "" : string_dict_proxy_->getString(ptr_[index].value);
532  }
533  DEVICE inline const TextEncodingDict getStringId(const std::string& str) {
534  return string_dict_proxy_->getOrAddTransient(str);
535  }
536 #endif // #ifndef UDF_COMPILED
537 #endif // #ifndef __CUDACC__
538 
540 #ifndef __CUDACC__
541  if (size() == other.size()) {
542  memcpy(ptr_, other.ptr_, other.size() * sizeof(TextEncodingDict));
543  } else {
544  throw std::runtime_error("cannot copy assign columns with different sizes");
545  }
546 #else
547  if (size() == other.size()) {
548  for (unsigned int i = 0; i < size(); i++) {
549  ptr_[i] = other[i];
550  }
551  } else {
552  // TODO: set error
553  }
554 #endif
555  return *this;
556  }
557 
558 #ifdef HAVE_TOSTRING
559  std::string toString() const {
560  return ::typeName(this) + "(ptr=" + ::toString(reinterpret_cast<void*>(ptr_)) +
561  ", size=" + std::to_string(size_) + ")";
562  }
563 #endif
564 };
565 
566 template <>
567 DEVICE inline bool Column<Timestamp>::isNull(int64_t index) const {
568  return is_null(ptr_[index].time);
569 }
570 
571 template <>
572 DEVICE inline void Column<Timestamp>::setNull(int64_t index) {
573  set_null(ptr_[index].time);
574 }
575 
576 template <>
578  set_null(t.time);
579 }
580 
581 /*
582  ColumnList is an ordered list of Columns.
583 */
584 template <typename T>
585 struct ColumnList {
586  int8_t** ptrs_; // ptrs to columns data
587  int64_t num_cols_; // the length of columns list
588  int64_t size_; // the size of columns
589 
590  DEVICE int64_t size() const { return size_; }
591  DEVICE int64_t numCols() const { return num_cols_; }
592  DEVICE Column<T> operator[](const int index) const {
593  if (index >= 0 && index < num_cols_)
594  return {reinterpret_cast<T*>(ptrs_[index]), size_};
595  else
596  return {nullptr, -1};
597  }
598 
599 #ifdef HAVE_TOSTRING
600 
601  std::string toString() const {
602  std::string result = ::typeName(this) + "(ptrs=[";
603  for (int64_t index = 0; index < num_cols_; index++) {
604  result += ::toString(reinterpret_cast<void*>(ptrs_[index])) +
605  (index < num_cols_ - 1 ? ", " : "");
606  }
607  result += "], num_cols=" + std::to_string(num_cols_) +
608  ", size=" + std::to_string(size_) + ")";
609  return result;
610  }
611 
612 #endif
613 };
614 
615 template <>
617  int8_t** ptrs_; // ptrs to columns data
618  int64_t num_cols_; // the length of columns list
619  int64_t size_; // the size of columns
620 #ifndef __CUDACC__
621 #ifndef UDF_COMPILED
622  StringDictionaryProxy** string_dict_proxies_; // the size of columns
623 #endif // #ifndef UDF_COMPILED
624 #endif // #ifndef __CUDACC__
625 
626  DEVICE int64_t size() const { return size_; }
627  DEVICE int64_t numCols() const { return num_cols_; }
628  DEVICE Column<TextEncodingDict> operator[](const int index) const {
629  if (index >= 0 && index < num_cols_) {
630  return {reinterpret_cast<TextEncodingDict*>(ptrs_[index]),
631  size_,
632 #ifndef __CUDACC__
633 #ifndef UDF_COMPILED
634  string_dict_proxies_[index]
635 #endif // #ifndef UDF_COMPILED
636 #endif // #ifndef __CUDACC__
637  };
638  } else {
639  return {nullptr,
640  -1
641 #ifndef __CUDACC__
642 #ifndef UDF_COMPILED
643  ,
644  nullptr
645 #endif // #ifndef UDF_COMPILED
646 #endif // #ifndef__CUDACC__
647  };
648  }
649  }
650 
651 #ifdef HAVE_TOSTRING
652 
653  std::string toString() const {
654  std::string result = ::typeName(this) + "(ptrs=[";
655  for (int64_t index = 0; index < num_cols_; index++) {
656  result += ::toString(reinterpret_cast<void*>(ptrs_[index])) +
657  (index < num_cols_ - 1 ? ", " : "");
658  }
659  result += "], num_cols=" + std::to_string(num_cols_) +
660  ", size=" + std::to_string(size_) + ")";
661  return result;
662  }
663 
664 #endif
665 };
666 
667 /*
668  This TableFunctionManager struct is a minimal proxy to the
669  TableFunctionManager defined in TableFunctionManager.h. The
670  corresponding instances share `this` but have different virtual
671  tables for methods.
672 */
673 #ifndef __CUDACC__
676  return reinterpret_cast<TableFunctionManager*>(TableFunctionManager_get_singleton());
677  }
678 
679  void set_output_row_size(int64_t num_rows) {
680  if (!output_allocations_disabled) {
681  TableFunctionManager_set_output_row_size(reinterpret_cast<int8_t*>(this), num_rows);
682  }
683  }
684 
685  void disable_output_allocations() { output_allocations_disabled = true; }
686 
687  void enable_output_allocations() { output_allocations_disabled = false; }
688 
689  int32_t error_message(const char* message) {
690  return TableFunctionManager_error_message(reinterpret_cast<int8_t*>(this), message);
691  }
692 
693 #ifdef HAVE_TOSTRING
694  std::string toString() const {
695  std::string result = ::typeName(this) + "(";
696  if (!(void*)this) { // cast to void* to avoid warnings
697  result += "UNINITIALIZED";
698  }
699  result += ")";
700  return result;
701  }
702 #endif // HAVE_TOSTRING
703  bool output_allocations_disabled{false};
704 };
705 #endif // #ifndef __CUDACC__
706 
707 #endif // #ifndef UDF_COMPILED
DEVICE const std::string getString(int64_t index) const
Definition: heavydbTypes.h:530
void set_output_row_size(int64_t num_rows)
Definition: heavydbTypes.h:679
int32_t compression
Definition: heavydbTypes.h:395
DEVICE ALWAYS_INLINE Timestamp truncateToSeconds() const
Definition: heavydbTypes.h:295
DEVICE ALWAYS_INLINE Timestamp truncateToDay() const
Definition: heavydbTypes.h:308
DEVICE int32_t getCompression() const
Definition: heavydbTypes.h:431
int8_t * ptr_coords
Definition: heavydbTypes.h:391
DEVICE ALWAYS_INLINE bool operator!=(const int64_t &other) const
Definition: heavydbTypes.h:109
DEVICE int32_t getInputSrid() const
Definition: heavydbTypes.h:406
int64_t DateTruncate(DatetruncField field, const int64_t timeval)
EXTENSION_NOINLINE_HOST void set_output_row_size(int64_t num_rows)
int32_t output_srid
Definition: heavydbTypes.h:397
#define EXTENSION_NOINLINE
Definition: heavydbTypes.h:47
DEVICE ALWAYS_INLINE const Timestamp operator+(const Timestamp &other) const
Definition: heavydbTypes.h:225
int32_t input_srid
Definition: heavydbTypes.h:362
static constexpr int64_t kNanoSecsPerSec
EXTENSION_NOINLINE_HOST int8_t * TableFunctionManager_get_singleton()
std::string getString() const
Definition: heavydbTypes.h:186
DEVICE ALWAYS_INLINE bool operator<(const TextEncodingDict &other) const
Definition: heavydbTypes.h:113
Simplified core of GeoJSON Polygon coordinates definition.
Definition: heavydbTypes.h:390
int64_t size
Definition: heavydbTypes.h:140
DEVICE ALWAYS_INLINE int64_t getMicroseconds() const
Definition: heavydbTypes.h:324
TextEncodingDict operator=(const int32_t other)
Definition: heavydbTypes.h:85
DEVICE int64_t size() const
Definition: heavydbTypes.h:469
CONSTEXPR DEVICE void set_null< Timestamp >(Timestamp &t)
Definition: heavydbTypes.h:577
int32_t coords_size
Definition: heavydbTypes.h:392
DEVICE Timestamp(std::string_view const str)
Definition: heavydbTypes.h:220
DEVICE int64_t numCols() const
Definition: heavydbTypes.h:591
DEVICE int8_t * getPolygonSizes()
Definition: heavydbTypes.h:427
DEVICE ALWAYS_INLINE int64_t getYear() const
Definition: heavydbTypes.h:347
T * ptr_
Definition: heavydbTypes.h:454
int64_t time
Definition: heavydbTypes.h:213
DEVICE Column< T > & operator=(const Column< T > &other)
Definition: heavydbTypes.h:473
DEVICE Column< T > operator[](const int index) const
Definition: heavydbTypes.h:592
DEVICE int8_t * getRingSizes()
Definition: heavydbTypes.h:422
DEVICE int64_t size() const
Definition: heavydbTypes.h:626
DEVICE void setNull(int64_t index)
Definition: heavydbTypes.h:526
DEVICE ALWAYS_INLINE Timestamp truncateToHours() const
Definition: heavydbTypes.h:304
DEVICE ALWAYS_INLINE int64_t getDay() const
Definition: heavydbTypes.h:341
DEVICE ALWAYS_INLINE bool operator==(const Timestamp &other) const
Definition: heavydbTypes.h:275
int8_t * ptr
Definition: heavydbTypes.h:375
std::string to_string(char const *&&v)
int32_t compression
Definition: heavydbTypes.h:418
int32_t output_srid
Definition: heavydbTypes.h:363
DEVICE ALWAYS_INLINE int64_t size() const
Definition: heavydbTypes.h:208
Simplified core of GeoJSON MultiPolygon coordinates definition.
Definition: heavydbTypes.h:411
DEVICE int32_t getNumRings() const
Definition: heavydbTypes.h:425
#define DEVICE
DEVICE ALWAYS_INLINE Timestamp truncateToYear() const
Definition: heavydbTypes.h:316
EXTENSION_NOINLINE_HOST int32_t TableFunctionManager_error_message(int8_t *mgr_ptr, const char *message)
DEVICE ALWAYS_INLINE bool operator==(const TextEncodingDict &other) const
Definition: heavydbTypes.h:90
static constexpr int64_t kMilliSecsPerSec
DEVICE int32_t getInputSrid() const
Definition: heavydbTypes.h:369
int32_t output_srid
Definition: heavydbTypes.h:379
DEVICE int32_t getInputSrid() const
Definition: heavydbTypes.h:385
int32_t error_message(const char *message)
Definition: heavydbTypes.h:689
EXTENSION_NOINLINE int8_t * allocate_varlen_buffer(int64_t element_count, int64_t element_size)
DEVICE T & operator[](const unsigned int index) const
Definition: heavydbTypes.h:457
int32_t output_srid
Definition: heavydbTypes.h:420
CONSTEXPR DEVICE bool is_null(const T &value)
StringDictionaryProxy ** string_dict_proxies_
Definition: heavydbTypes.h:622
#define CONSTEXPR
DEVICE Array(const int64_t size, const bool is_null=false)
Definition: heavydbTypes.h:143
DEVICE TextEncodingDict inline_null_value()
Definition: heavydbTypes.h:127
DEVICE ALWAYS_INLINE bool operator<(const int32_t &other) const
Definition: heavydbTypes.h:117
DEVICE ALWAYS_INLINE bool operator!=(const int32_t &other) const
Definition: heavydbTypes.h:105
int64_t size_
Definition: heavydbTypes.h:588
DEVICE T operator()(const unsigned int index) const
Definition: heavydbTypes.h:153
int8_t * ring_sizes
Definition: heavydbTypes.h:414
DEVICE int32_t getCoordsSize() const
Definition: heavydbTypes.h:400
int32_t coords_size
Definition: heavydbTypes.h:413
StringDictionaryProxy * string_dict_proxy_
Definition: heavydbTypes.h:506
CONSTEXPR DEVICE void set_null(T &value)
int32_t input_srid
Definition: heavydbTypes.h:419
DEVICE int32_t getNumPolygons() const
Definition: heavydbTypes.h:429
TextEncodingNone(const std::string &str)
Definition: heavydbTypes.h:179
DEVICE int64_t getSize() const
Definition: heavydbTypes.h:163
#define EXTENSION_NOINLINE_HOST
Definition: heavydbTypes.h:44
DEVICE int32_t getCompression() const
Definition: heavydbTypes.h:404
DEVICE ALWAYS_INLINE bool operator==(const char *rhs) const
Definition: heavydbTypes.h:192
DEVICE const TextEncodingDict getStringId(const std::string &str)
Definition: heavydbTypes.h:533
DEVICE ALWAYS_INLINE int64_t operator/(const Timestamp &other) const
Definition: heavydbTypes.h:255
DEVICE int32_t getCoordsSize() const
Definition: heavydbTypes.h:423
DEVICE int32_t getInputSrid() const
Definition: heavydbTypes.h:433
DEVICE TextEncodingDict & operator[](const unsigned int index) const
Definition: heavydbTypes.h:510
int32_t compression
Definition: heavydbTypes.h:361
int8_t is_null
Definition: heavydbTypes.h:141
DEVICE ALWAYS_INLINE int64_t getMinutes() const
Definition: heavydbTypes.h:335
int32_t num_rings
Definition: heavydbTypes.h:394
DEVICE ALWAYS_INLINE int64_t getSeconds() const
Definition: heavydbTypes.h:332
std::string toString(const Executor::ExtModuleKinds &kind)
Definition: Execute.h:1448
DEVICE ALWAYS_INLINE bool operator!=(const TextEncodingDict &other) const
Definition: heavydbTypes.h:102
int8_t * ring_sizes
Definition: heavydbTypes.h:393
int32_t sz
Definition: heavydbTypes.h:360
void disable_output_allocations()
Definition: heavydbTypes.h:685
DEVICE ALWAYS_INLINE const Timestamp operator-(const Timestamp &other) const
Definition: heavydbTypes.h:240
EXTENSION_NOINLINE_HOST int32_t table_function_error(const char *message)
int8_t * poly_sizes
Definition: heavydbTypes.h:416
DEVICE int64_t numCols() const
Definition: heavydbTypes.h:627
DEVICE int32_t getNumRings() const
Definition: heavydbTypes.h:402
int8_t ** ptrs_
Definition: heavydbTypes.h:586
int64_t num_cols_
Definition: heavydbTypes.h:587
DEVICE ALWAYS_INLINE Timestamp truncateToMilliseconds() const
Definition: heavydbTypes.h:291
TextEncodingDict(const int32_t other)
Definition: heavydbTypes.h:79
DEVICE ALWAYS_INLINE bool operator!=(const Timestamp &other) const
Definition: heavydbTypes.h:279
DEVICE int32_t getSize() const
Definition: heavydbTypes.h:381
DEVICE int32_t getCompression() const
Definition: heavydbTypes.h:383
DEVICE constexpr T null_value() const
Definition: heavydbTypes.h:167
DEVICE int32_t getOutputSrid() const
Definition: heavydbTypes.h:408
DEVICE Timestamp(int64_t timeval)
Definition: heavydbTypes.h:217
DEVICE ALWAYS_INLINE char & operator[](const unsigned int index)
Definition: heavydbTypes.h:189
TextEncodingDict * ptr_
Definition: heavydbTypes.h:502
DEVICE bool isNull(int64_t index) const
Definition: heavydbTypes.h:471
int64_t size_
Definition: heavydbTypes.h:455
DEVICE ALWAYS_INLINE Timestamp truncateToMicroseconds() const
Definition: heavydbTypes.h:287
DEVICE void setNull(int64_t index)
Definition: heavydbTypes.h:472
int8_t * ptr
Definition: heavydbTypes.h:359
DEVICE int32_t getOutputSrid() const
Definition: heavydbTypes.h:371
DEVICE Column< TextEncodingDict > operator[](const int index) const
Definition: heavydbTypes.h:628
DEVICE ALWAYS_INLINE int64_t getMonth() const
Definition: heavydbTypes.h:344
int32_t compression
Definition: heavydbTypes.h:377
DEVICE int64_t ExtractFromTime(ExtractField field, const int64_t timeval)
DEVICE bool isNull(int64_t index) const
Definition: heavydbTypes.h:524
DEVICE int8_t * getRingSizes()
Definition: heavydbTypes.h:399
std::string typeName(const T *v)
Definition: toString.h:102
DEVICE int64_t getSize() const
Definition: heavydbTypes.h:365
DEVICE Column< TextEncodingDict > & operator=(const Column< TextEncodingDict > &other)
Definition: heavydbTypes.h:539
DEVICE ALWAYS_INLINE int64_t getHours() const
Definition: heavydbTypes.h:338
DEVICE ALWAYS_INLINE bool isNull() const
Definition: heavydbTypes.h:209
DEVICE int32_t getCompression() const
Definition: heavydbTypes.h:367
EXTENSION_NOINLINE_HOST void TableFunctionManager_set_output_row_size(int8_t *mgr_ptr, int64_t num_rows)
TextEncodingNone()=default
DEVICE ALWAYS_INLINE Timestamp truncateToMonth() const
Definition: heavydbTypes.h:312
DEVICE ALWAYS_INLINE bool operator<(const Timestamp &other) const
Definition: heavydbTypes.h:283
T * ptr
Definition: heavydbTypes.h:139
DEVICE ALWAYS_INLINE int64_t getMilliseconds() const
Definition: heavydbTypes.h:328
DEVICE T & operator[](const unsigned int index)
Definition: heavydbTypes.h:161
DEVICE int64_t size() const
Definition: heavydbTypes.h:522
Timestamp()=default
int8_t * ptr_coords
Definition: heavydbTypes.h:412
DEVICE int64_t size() const
Definition: heavydbTypes.h:590
DEVICE ALWAYS_INLINE const Timestamp operator*(const int64_t multiplier) const
Definition: heavydbTypes.h:264
DEVICE int32_t getOutputSrid() const
Definition: heavydbTypes.h:435
DEVICE ALWAYS_INLINE int64_t getNanoseconds() const
Definition: heavydbTypes.h:320
#define ALWAYS_INLINE
DEVICE ALWAYS_INLINE Timestamp truncateToMinutes() const
Definition: heavydbTypes.h:300
void enable_output_allocations()
Definition: heavydbTypes.h:687
DEVICE ALWAYS_INLINE bool operator==(const int32_t &other) const
Definition: heavydbTypes.h:94
static TableFunctionManager * get_singleton()
Definition: heavydbTypes.h:675
DEVICE bool isNull() const
Definition: heavydbTypes.h:165
DEVICE ALWAYS_INLINE bool operator<(const int64_t &other) const
Definition: heavydbTypes.h:121
int32_t input_srid
Definition: heavydbTypes.h:396
static constexpr int64_t kMicroSecsPerSec
DEVICE ALWAYS_INLINE bool operator!=(const char *rhs) const
Definition: heavydbTypes.h:204
int32_t input_srid
Definition: heavydbTypes.h:378
DEVICE ALWAYS_INLINE bool operator==(const int64_t &other) const
Definition: heavydbTypes.h:98
DEVICE int32_t getOutputSrid() const
Definition: heavydbTypes.h:387