OmniSciDB  72c90bc290
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
heavydbTypes.h File Reference
#include <cmath>
#include <cstring>
#include <limits>
#include <stdexcept>
#include <type_traits>
#include <vector>
#include "DateTruncate.h"
#include "ExtractFromTime.h"
#include "TableFunctionMetadataType.h"
#include "Utils/FlatBuffer.h"
#include "DateAdd.h"
#include "../Shared/sqltypes_lite.h"
#include "../Shared/DateTimeParser.h"
#include "../Shared/InlineNullValues.h"
#include "../Shared/funcannotations.h"
#include "Shared/toString.h"
#include "StringDictionary/StringDictionaryProxy.h"
#include "../Geospatial/CompressionRuntime.h"
+ Include dependency graph for heavydbTypes.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  TextEncodingDict
 
struct  RowFunctionManager
 
struct  TableFunctionManager
 
struct  flatbuffer::Array< T >
 
struct  Array< T >
 
struct  TextEncodingNone
 
struct  Timestamp
 
struct  DayTimeInterval
 
struct  YearMonthTimeInterval
 
struct  GeoPointStruct
 
struct  GeoMultiPointStruct
 
struct  GeoLineStringStruct
 
struct  GeoMultiLineStringStruct
 
struct  GeoPolygonStruct
 
struct  GeoMultiPolygonStruct
 
struct  Column< T >
 
struct  flatbuffer::Column< RowType, RowStruct >
 
struct  flatbuffer::NestedArray< ItemType >
 
struct  flatbuffer::TextEncodingNone
 
struct  flatbuffer::Array< T >
 
struct  Geo::Point2D
 
struct  Geo::GeoNestedArray< ItemType >
 
struct  Geo::LineString
 
struct  Geo::MultiPoint
 
struct  Geo::MultiLineString
 
struct  Geo::Polygon
 
struct  Geo::MultiPolygon
 
struct  Column< GeoLineString >
 
struct  Column< GeoMultiPoint >
 
struct  Column< GeoPolygon >
 
struct  Column< GeoMultiLineString >
 
struct  Column< GeoMultiPolygon >
 
struct  Column< GeoPoint >
 
struct  Column< TextEncodingNone >
 
struct  Column< Array< T > >
 
struct  Column< Array< TextEncodingDict > >
 
struct  Column< TextEncodingDict >
 
struct  ColumnList< T >
 
struct  ColumnList< Array< T > >
 
struct  ColumnList< TextEncodingDict >
 

Namespaces

 anonymous_namespace{heavydbTypes.h}
 
 flatbuffer
 
 Geo
 

Macros

#define EXTENSION_INLINE_HOST   extern "C" RUNTIME_EXPORT ALWAYS_INLINE HOST
 
#define EXTENSION_NOINLINE_HOST   extern "C" RUNTIME_EXPORT NEVER_INLINE HOST
 
#define EXTENSION_INLINE   extern "C" RUNTIME_EXPORT ALWAYS_INLINE DEVICE
 
#define EXTENSION_NOINLINE   extern "C" RUNTIME_EXPORT NEVER_INLINE DEVICE
 
#define TEMPLATE_INLINE   ALWAYS_INLINE DEVICE
 
#define TEMPLATE_NOINLINE   NEVER_INLINE DEVICE
 
#define FUNC_NAME   (std::string(__func__).substr(0, std::string(__func__).find("__")))
 
#define ERROR_STRING(MSG)
 
#define TABLE_FUNCTION_ERROR(MSG)   table_function_error(ERROR_STRING(MSG))
 
#define ERROR_MESSAGE(MSG)   error_message(ERROR_STRING(MSG))
 
#define SUCCESS   table_function_success_code()
 
#define GET_DICT_DB_ID(mgr, arg_idx)   (mgr.getDictDbId(__func__, arg_idx))
 
#define GET_DICT_ID(mgr, arg_idx)   (mgr.getDictId(__func__, arg_idx))
 
#define NESTED_ARRAY_NDIM   4
 
#define IS_VALUE_TYPE(T)
 

Typedefs

typedef struct GeoPointStruct GeoPoint
 
typedef struct GeoMultiPointStruct GeoMultiPoint
 
typedef struct GeoLineStringStruct GeoLineString
 
typedef struct
GeoMultiLineStringStruct 
GeoMultiLineString
 
typedef struct GeoPolygonStruct GeoPolygon
 
typedef struct
GeoMultiPolygonStruct 
GeoMultiPolygon
 

Functions

EXTENSION_NOINLINE int8_t * allocate_varlen_buffer (int64_t element_count, int64_t element_size)
 
EXTENSION_NOINLINE_HOST void set_output_item_values_total_number (int32_t index, int64_t output_item_values_total_number)
 
EXTENSION_NOINLINE_HOST void set_output_array_values_total_number (int32_t index, int64_t output_array_values_total_number)
 
EXTENSION_NOINLINE_HOST void set_output_row_size (int64_t num_rows)
 
EXTENSION_NOINLINE_HOST void TableFunctionManager_set_output_array_values_total_number (int8_t *mgr_ptr, int32_t index, int64_t output_array_values_total_number)
 
EXTENSION_NOINLINE_HOST void TableFunctionManager_set_output_item_values_total_number (int8_t *mgr_ptr, int32_t index, int64_t output_item_values_total_number)
 
EXTENSION_NOINLINE_HOST void TableFunctionManager_set_output_row_size (int8_t *mgr_ptr, int64_t num_rows)
 
EXTENSION_NOINLINE_HOST int8_t * TableFunctionManager_get_singleton ()
 
EXTENSION_NOINLINE_HOST int32_t table_function_error (const char *message)
 
EXTENSION_NOINLINE_HOST int32_t table_function_success_code ()
 
EXTENSION_NOINLINE_HOST int32_t TableFunctionManager_error_message (int8_t *mgr_ptr, const char *message)
 
EXTENSION_NOINLINE_HOST void TableFunctionManager_set_metadata (int8_t *mgr_ptr, const char *key, const uint8_t *raw_bytes, const size_t num_bytes, const TableFunctionMetadataType value_type)
 
EXTENSION_NOINLINE_HOST void TableFunctionManager_get_metadata (int8_t *mgr_ptr, const char *key, const uint8_t *&raw_bytes, size_t &num_bytes, TableFunctionMetadataType &value_type)
 
EXTENSION_NOINLINE_HOST int32_t TableFunctionManager_getNewDictDbId (int8_t *mgr_ptr)
 
EXTENSION_NOINLINE_HOST int32_t TableFunctionManager_getNewDictId (int8_t *mgr_ptr)
 
EXTENSION_NOINLINE_HOST int8_t * TableFunctionManager_getStringDictionaryProxy (int8_t *mgr_ptr, int32_t db_id, int32_t dict_id)
 
std::string TableFunctionManager_getString (int8_t *mgr_ptr, int32_t db_id, int32_t dict_id, int32_t string_id)
 
EXTENSION_NOINLINE_HOST int32_t TableFunctionManager_getOrAddTransient (int8_t *mgr_ptr, int32_t db_id, int32_t dict_id, std::string str)
 
EXTENSION_NOINLINE_HOST int8_t * TableFunctionManager_makeBuffer (int8_t *mgr_ptr, int64_t count, int64_t size)
 
RUNTIME_EXPORT NEVER_INLINE
HOST std::string 
RowFunctionManager_getString (int8_t *mgr_ptr, int32_t db_id, int32_t dict_id, int32_t string_id)
 
EXTENSION_NOINLINE_HOST int32_t RowFunctionManager_getDictDbId (int8_t *mgr_ptr, const char *func_name, size_t arg_idx)
 
EXTENSION_NOINLINE_HOST int32_t RowFunctionManager_getDictId (int8_t *mgr_ptr, const char *func_name, size_t arg_idx)
 
EXTENSION_NOINLINE_HOST int32_t RowFunctionManager_getOrAddTransient (int8_t *mgr_ptr, int32_t db_id, int32_t dict_id, std::string str)
 
EXTENSION_NOINLINE_HOST int8_t * RowFunctionManager_makeBuffer (int8_t *mgr_ptr, int64_t count, int64_t size)
 
EXTENSION_NOINLINE_HOST void ColumnArray_getArray (int8_t *flatbuffer, const int64_t index, const int64_t expected_numel, int8_t *&ptr, int64_t &size, bool &is_null)
 
EXTENSION_NOINLINE_HOST bool ColumnArray_isNull (int8_t *flatbuffer, int64_t index)
 
EXTENSION_NOINLINE_HOST void ColumnArray_setNull (int8_t *flatbuffer, int64_t index)
 
EXTENSION_NOINLINE_HOST void ColumnArray_setArray (int8_t *flatbuffer, int64_t index, const int8_t *ptr, int64_t size, bool is_null)
 
EXTENSION_NOINLINE_HOST void ColumnArray_concatArray (int8_t *flatbuffer, int64_t index, const int8_t *ptr, int64_t size, bool is_null)
 
EXTENSION_NOINLINE_HOST void ColumnArray_getItem (int8_t *flatbuffer, const int64_t index, const int64_t expected_numel, int8_t *&ptr, int64_t &size, bool &is_null, int64_t sizeof_T)
 
EXTENSION_NOINLINE_HOST void ColumnArray_setItem (int8_t *flatbuffer, int64_t index, const int8_t *ptr, int64_t size, bool is_null, int64_t sizeof_T)
 
EXTENSION_NOINLINE_HOST void ColumnArray_concatItem (int8_t *flatbuffer, int64_t index, const int8_t *ptr, int64_t size, bool is_null, int64_t sizeof_T)
 
template<>
DEVICE TextEncodingDict inline_null_value ()
 
template<typename T >
TableFunctionMetadataType anonymous_namespace{heavydbTypes.h}::get_metadata_type ()
 
template<>
DEVICE Timestamp inline_null_value ()
 
DEVICE int32_t Geo::compress_x_coord (const double *x, const int64_t index)
 
DEVICE int32_t Geo::compress_y_coord (const double *x, const int64_t index)
 
DEVICE double Geo::decompress_x_coord (const int8_t *data, const int64_t index, const bool is_geoint)
 
DEVICE double Geo::decompress_y_coord (const int8_t *data, const int64_t index, const bool is_geoint)
 
DEVICE double Geo::decompress_x_coord (const int8_t *data, const int64_t index, const bool is_geoint, const int32_t input_srid, const int32_t output_srid)
 
DEVICE double Geo::decompress_y_coord (const int8_t *data, const int64_t index, const bool is_geoint, const int32_t input_srid, const int32_t output_srid)
 
DEVICE Point2D Geo::get_point (const int8_t *data, const int64_t index, const int32_t input_srid, const int32_t output_srid, const bool is_geoint)
 
template<typename CT >
void Geo::points_to_vector (const int8_t *points_buf, const int64_t nof_points, const bool is_geoint, std::vector< CT > &result)
 
std::vector< int32_t > Geo::compress_coords (const int8_t *data, const int64_t size, const bool is_geoint)
 
std::vector< double > Geo::decompress_coords (const int8_t *data, const int64_t size, const bool is_geoint)
 
std::vector< int32_t > Geo::compress_coords (const std::vector< double > &coords)
 
std::vector< double > Geo::decompress_coords (const std::vector< int32_t > &coords)
 
std::vector< std::vector
< int32_t > > 
Geo::compress_coords (const std::vector< std::vector< double >> &coords)
 
std::vector< std::vector
< double > > 
Geo::decompress_coords (const std::vector< std::vector< int32_t >> &coords)
 
std::vector< std::vector
< std::vector< int32_t > > > 
Geo::compress_coords (const std::vector< std::vector< std::vector< double >>> &coords)
 
std::vector< std::vector
< std::vector< double > > > 
Geo::decompress_coords (const std::vector< std::vector< std::vector< int32_t >>> &coords)
 
bool Geo::get_is_geoint (const int8_t *flatbuffer)
 
int32_t Geo::get_input_srid (const int8_t *flatbuffer)
 
int32_t Geo::get_output_srid (const int8_t *flatbuffer)
 
template<>
CONSTEXPR DEVICE void set_null< Timestamp > (Timestamp &t)
 

Macro Definition Documentation

#define ERROR_MESSAGE (   MSG)    error_message(ERROR_STRING(MSG))

Definition at line 75 of file heavydbTypes.h.

#define ERROR_STRING (   MSG)
Value:
(std::string(__FILE__).substr(std::string(__FILE__).rfind("/") + 1) + ":" + \
std::to_string(__LINE__) + " " + FUNC_NAME + ": " + MSG) \
.c_str()
std::string to_string(char const *&&v)
#define FUNC_NAME
Definition: heavydbTypes.h:68

Definition at line 70 of file heavydbTypes.h.

#define EXTENSION_INLINE   extern "C" RUNTIME_EXPORT ALWAYS_INLINE DEVICE

Definition at line 57 of file heavydbTypes.h.

#define EXTENSION_INLINE_HOST   extern "C" RUNTIME_EXPORT ALWAYS_INLINE HOST

Definition at line 54 of file heavydbTypes.h.

#define EXTENSION_NOINLINE   extern "C" RUNTIME_EXPORT NEVER_INLINE DEVICE

Definition at line 58 of file heavydbTypes.h.

#define EXTENSION_NOINLINE_HOST   extern "C" RUNTIME_EXPORT NEVER_INLINE HOST

Definition at line 55 of file heavydbTypes.h.

#define FUNC_NAME   (std::string(__func__).substr(0, std::string(__func__).find("__")))

Definition at line 68 of file heavydbTypes.h.

#define GET_DICT_DB_ID (   mgr,
  arg_idx 
)    (mgr.getDictDbId(__func__, arg_idx))
#define IS_VALUE_TYPE (   T)
Value:
(std::is_scalar<T>::value || std::is_same<T, TextEncodingDict>::value || \
std::is_same<T, Geo::Point2D>::value)

Definition at line 454 of file heavydbTypes.h.

Referenced by flatbuffer::NestedArray< char >::getItem(), flatbuffer::NestedArray< char >::getRawBuffer(), and flatbuffer::NestedArray< char >::getValue().

#define TABLE_FUNCTION_ERROR (   MSG)    table_function_error(ERROR_STRING(MSG))

Definition at line 74 of file heavydbTypes.h.

Referenced by column_list_safe_row_sum__cpu_template(), and ct_sleep1__cpu_().

#define TEMPLATE_INLINE   ALWAYS_INLINE DEVICE

Definition at line 59 of file heavydbTypes.h.

#define TEMPLATE_NOINLINE   NEVER_INLINE DEVICE

Definition at line 60 of file heavydbTypes.h.

Typedef Documentation

Definition at line 999 of file heavydbTypes.h.

Definition at line 1025 of file heavydbTypes.h.

Definition at line 981 of file heavydbTypes.h.

Definition at line 1077 of file heavydbTypes.h.

typedef struct GeoPointStruct GeoPoint

Definition at line 963 of file heavydbTypes.h.

typedef struct GeoPolygonStruct GeoPolygon

Definition at line 1048 of file heavydbTypes.h.

Function Documentation

EXTENSION_NOINLINE int8_t* allocate_varlen_buffer ( int64_t  element_count,
int64_t  element_size 
)

Referenced by Array< T >::Array().

+ Here is the caller graph for this function:

EXTENSION_NOINLINE_HOST void ColumnArray_concatArray ( int8_t *  flatbuffer,
int64_t  index,
const int8_t *  ptr,
int64_t  size,
bool  is_null 
)
EXTENSION_NOINLINE_HOST void ColumnArray_concatItem ( int8_t *  flatbuffer,
int64_t  index,
const int8_t *  ptr,
int64_t  size,
bool  is_null,
int64_t  sizeof_T 
)
EXTENSION_NOINLINE_HOST void ColumnArray_getArray ( int8_t *  flatbuffer,
const int64_t  index,
const int64_t  expected_numel,
int8_t *&  ptr,
int64_t &  size,
bool &  is_null 
)
EXTENSION_NOINLINE_HOST void ColumnArray_getItem ( int8_t *  flatbuffer,
const int64_t  index,
const int64_t  expected_numel,
int8_t *&  ptr,
int64_t &  size,
bool &  is_null,
int64_t  sizeof_T 
)
EXTENSION_NOINLINE_HOST bool ColumnArray_isNull ( int8_t *  flatbuffer,
int64_t  index 
)
EXTENSION_NOINLINE_HOST void ColumnArray_setArray ( int8_t *  flatbuffer,
int64_t  index,
const int8_t *  ptr,
int64_t  size,
bool  is_null 
)
EXTENSION_NOINLINE_HOST void ColumnArray_setItem ( int8_t *  flatbuffer,
int64_t  index,
const int8_t *  ptr,
int64_t  size,
bool  is_null,
int64_t  sizeof_T 
)
EXTENSION_NOINLINE_HOST void ColumnArray_setNull ( int8_t *  flatbuffer,
int64_t  index 
)
template<>
DEVICE TextEncodingDict inline_null_value ( )
inline

Definition at line 279 of file heavydbTypes.h.

References TextEncodingDict::value.

279  {
280 #ifndef __CUDACC__
281  return TextEncodingDict(inline_int_null_value<int32_t>());
282 #else
283  TextEncodingDict null_val;
284  null_val.value = inline_int_null_value<int32_t>();
285  return null_val;
286 #endif
287 }
template<>
DEVICE Timestamp inline_null_value ( )
inline

Definition at line 849 of file heavydbTypes.h.

849  {
850  return Timestamp(inline_int_null_value<int64_t>());
851 }
EXTENSION_NOINLINE_HOST int32_t RowFunctionManager_getDictDbId ( int8_t *  mgr_ptr,
const char *  func_name,
size_t  arg_idx 
)

Referenced by RowFunctionManager::getDictDbId().

+ Here is the caller graph for this function:

EXTENSION_NOINLINE_HOST int32_t RowFunctionManager_getDictId ( int8_t *  mgr_ptr,
const char *  func_name,
size_t  arg_idx 
)

Referenced by RowFunctionManager::getDictId().

+ Here is the caller graph for this function:

EXTENSION_NOINLINE_HOST int32_t RowFunctionManager_getOrAddTransient ( int8_t *  mgr_ptr,
int32_t  db_id,
int32_t  dict_id,
std::string  str 
)

Referenced by RowFunctionManager::getOrAddTransient().

+ Here is the caller graph for this function:

RUNTIME_EXPORT NEVER_INLINE HOST std::string RowFunctionManager_getString ( int8_t *  mgr_ptr,
int32_t  db_id,
int32_t  dict_id,
int32_t  string_id 
)

Referenced by RowFunctionManager::getString().

+ Here is the caller graph for this function:

EXTENSION_NOINLINE_HOST int8_t* RowFunctionManager_makeBuffer ( int8_t *  mgr_ptr,
int64_t  count,
int64_t  size 
)

Referenced by RowFunctionManager::makeBuffer().

+ Here is the caller graph for this function:

template<>
CONSTEXPR DEVICE void set_null< Timestamp > ( Timestamp t)
inline

Definition at line 2476 of file heavydbTypes.h.

References set_null().

2476  {
2477  set_null(t.time);
2478 }
int64_t time
Definition: heavydbTypes.h:699
CONSTEXPR DEVICE void set_null(T &value)

+ Here is the call graph for this function:

EXTENSION_NOINLINE_HOST void set_output_array_values_total_number ( int32_t  index,
int64_t  output_array_values_total_number 
)
EXTENSION_NOINLINE_HOST void set_output_item_values_total_number ( int32_t  index,
int64_t  output_item_values_total_number 
)
EXTENSION_NOINLINE_HOST int32_t table_function_error ( const char *  message)
EXTENSION_NOINLINE_HOST int32_t table_function_success_code ( )
EXTENSION_NOINLINE_HOST int32_t TableFunctionManager_error_message ( int8_t *  mgr_ptr,
const char *  message 
)

Referenced by TableFunctionManager::error_message().

+ Here is the caller graph for this function:

EXTENSION_NOINLINE_HOST void TableFunctionManager_get_metadata ( int8_t *  mgr_ptr,
const char *  key,
const uint8_t *&  raw_bytes,
size_t &  num_bytes,
TableFunctionMetadataType value_type 
)

Referenced by TableFunctionManager::get_metadata().

+ Here is the caller graph for this function:

EXTENSION_NOINLINE_HOST int8_t* TableFunctionManager_get_singleton ( )

Referenced by TableFunctionManager::get_singleton().

+ Here is the caller graph for this function:

EXTENSION_NOINLINE_HOST int32_t TableFunctionManager_getNewDictDbId ( int8_t *  mgr_ptr)

Referenced by TableFunctionManager::getNewDictDbId().

+ Here is the caller graph for this function:

EXTENSION_NOINLINE_HOST int32_t TableFunctionManager_getNewDictId ( int8_t *  mgr_ptr)

Referenced by TableFunctionManager::getNewDictId().

+ Here is the caller graph for this function:

EXTENSION_NOINLINE_HOST int32_t TableFunctionManager_getOrAddTransient ( int8_t *  mgr_ptr,
int32_t  db_id,
int32_t  dict_id,
std::string  str 
)

Referenced by TableFunctionManager::getOrAddTransient().

+ Here is the caller graph for this function:

std::string TableFunctionManager_getString ( int8_t *  mgr_ptr,
int32_t  db_id,
int32_t  dict_id,
int32_t  string_id 
)

Referenced by TableFunctionManager::getString().

+ Here is the caller graph for this function:

EXTENSION_NOINLINE_HOST int8_t* TableFunctionManager_getStringDictionaryProxy ( int8_t *  mgr_ptr,
int32_t  db_id,
int32_t  dict_id 
)

Referenced by TableFunctionManager::getStringDictionaryProxy().

+ Here is the caller graph for this function:

EXTENSION_NOINLINE_HOST int8_t* TableFunctionManager_makeBuffer ( int8_t *  mgr_ptr,
int64_t  count,
int64_t  size 
)

Referenced by TableFunctionManager::makeBuffer().

+ Here is the caller graph for this function:

EXTENSION_NOINLINE_HOST void TableFunctionManager_set_metadata ( int8_t *  mgr_ptr,
const char *  key,
const uint8_t *  raw_bytes,
const size_t  num_bytes,
const TableFunctionMetadataType  value_type 
)

Referenced by TableFunctionManager::set_metadata().

+ Here is the caller graph for this function:

EXTENSION_NOINLINE_HOST void TableFunctionManager_set_output_array_values_total_number ( int8_t *  mgr_ptr,
int32_t  index,
int64_t  output_array_values_total_number 
)

Referenced by TableFunctionManager::set_output_array_values_total_number().

+ Here is the caller graph for this function:

EXTENSION_NOINLINE_HOST void TableFunctionManager_set_output_item_values_total_number ( int8_t *  mgr_ptr,
int32_t  index,
int64_t  output_item_values_total_number 
)

Referenced by TableFunctionManager::set_output_item_values_total_number().

+ Here is the caller graph for this function:

EXTENSION_NOINLINE_HOST void TableFunctionManager_set_output_row_size ( int8_t *  mgr_ptr,
int64_t  num_rows 
)

Referenced by TableFunctionManager::set_output_row_size().

+ Here is the caller graph for this function: