25 #include "../Logger/Logger.h"
33 #include <type_traits>
107 return "DAY TIME INTERVAL";
109 return "YEAR MONTH INTERVAL";
117 return "MULTIPOLYGON";
125 return "UNEVALUATED ANY";
171 template <
typename CUSTOM_DELETER,
172 typename = std::enable_if_t<
173 std::is_void<std::result_of_t<CUSTOM_DELETER(int8_t*)> >::value> >
177 template <
typename CUSTOM_DELETER,
178 typename = std::enable_if_t<
179 std::is_void<std::result_of_t<CUSTOM_DELETER(int8_t*)> >::value> >
180 HostArrayDatum(
size_t const l, int8_t* p,
bool const n, CUSTOM_DELETER custom_deleter)
199 std::conditional_t<is_cuda_compiler(), DeviceArrayDatum, HostArrayDatum>;
236 #define IS_INTEGER(T) \
237 (((T) == kINT) || ((T) == kSMALLINT) || ((T) == kBIGINT) || ((T) == kTINYINT))
238 #define IS_NUMBER(T) \
239 (((T) == kINT) || ((T) == kSMALLINT) || ((T) == kDOUBLE) || ((T) == kFLOAT) || \
240 ((T) == kBIGINT) || ((T) == kNUMERIC) || ((T) == kDECIMAL) || ((T) == kTINYINT))
241 #define IS_STRING(T) (((T) == kTEXT) || ((T) == kVARCHAR) || ((T) == kCHAR))
243 (((T) == kPOINT) || ((T) == kLINESTRING) || ((T) == kPOLYGON) || ((T) == kMULTIPOLYGON))
244 #define IS_INTERVAL(T) ((T) == kINTERVAL_DAY_TIME || (T) == kINTERVAL_YEAR_MONTH)
245 #define IS_DECIMAL(T) ((T) == kNUMERIC || (T) == kDECIMAL)
246 #define IS_GEO_POLY(T) (((T) == kPOLYGON) || ((T) == kMULTIPOLYGON))
250 #define TRANSIENT_DICT_ID 0
251 #define TRANSIENT_DICT(ID) (-(ID))
252 #define REGULAR_DICT(TRANSIENTID) (-(TRANSIENTID))
416 std::string srid_string =
"";
434 return elem_ti.get_type_name() + ps +
"[" + num_elems +
"]";
441 return "COLUMN<" +
type_name[
static_cast<int>(
subtype)] + ps +
">" + num_elems;
543 return sizeof(int32_t);
653 if (
type ==
kARRAY && val && array_size > 0 && array_size ==
size) {
658 elem_ti.set_subtype(
kNULLT);
659 auto elem_size = elem_ti.get_storage_size();
685 int array_size)
const {
687 array_size ==
size) {
688 if (array_size == 2 *
sizeof(
double)) {
691 if (array_size == 2 *
sizeof(int32_t)) {
745 return sizeof(int8_t);
747 return sizeof(int8_t);
751 return sizeof(int16_t);
765 return sizeof(int32_t);
781 return sizeof(int64_t);
795 return sizeof(float);
809 return sizeof(double);
827 return sizeof(int64_t);
857 return sizeof(int32_t);
879 #include <string_view>
889 #include "../QueryEngine/DateAdd.h"
890 #include "../QueryEngine/DateTruncate.h"
891 #include "../QueryEngine/ExtractFromTime.h"
911 return nullable_type_info;
926 return buf +
sizeof(
bool);
931 return buf +
sizeof(int64_t);
933 *(int32_t*)buf = d.
intval;
934 return buf +
sizeof(int32_t);
937 return buf +
sizeof(int16_t);
940 return buf +
sizeof(int8_t);
943 return buf +
sizeof(
float);
946 return buf +
sizeof(
double);
950 *
reinterpret_cast<int64_t*
>(buf) = d.
bigintval;
951 return buf +
sizeof(int64_t);
HOST DEVICE SQLTypes get_subtype() const
void set_compression(EncodingType c)
HOST DEVICE int get_size() const
HOST DEVICE void operator=(const SQLTypeInfo &rhs)
std::string DatumToString(Datum d, const SQLTypeInfo &ti)
bool is_varlen_array() const
std::string toString(const ExtArgumentType &sig_type)
DEVICE constexpr bool is_cuda_compiler()
std::vector< std::string > * stringsPtr
bool is_timestamp() const
std::vector< ArrayDatum > * arraysPtr
SQLTypeInfo get_nullable_logical_type_info(const SQLTypeInfo &type_info)
HOST DEVICE bool operator==(const SQLTypeInfo &rhs) const
HOST DEVICE int get_scale() const
#define NULL_ARRAY_SMALLINT
std::string get_compression_name() const
HOST DEVICE void set_subtype(SQLTypes st)
SQLTypeInfo(SQLTypes t, int d, int s)
SQLTypeInfo get_logical_type_info(const SQLTypeInfo &type_info)
#define NULL_ARRAY_TINYINT
HOST DEVICE bool is_null_fixlen_array(const int8_t *val, int array_size) const
HOST DEVICE SQLTypes get_type() const
HostArrayDatum(size_t const l, int8_t *p, bool const n, CUSTOM_DELETER custom_deleter)
bool has_render_group() const
std::conditional_t< is_cuda_compiler(), DeviceArrayDatum, HostArrayDatum > ArrayDatum
void set_input_srid(int d)
std::string to_string() const
int get_physical_cols() const
bool is_fixlen_array() const
bool is_castable(const SQLTypeInfo &new_type_info) const
std::shared_ptr< int8_t > ManagedPtr
HOST DEVICE bool operator!=(const SQLTypeInfo &rhs) const
int get_logical_size() const
bool DatumEqual(const Datum a, const Datum b, const SQLTypeInfo &ti)
static std::string type_name[kSQLTYPE_LAST]
VarlenDatum(const size_t l, int8_t *p, const bool n)
#define NULL_ARRAY_COMPRESSED_32
HostArrayDatum(size_t const l, int8_t *p, CUSTOM_DELETER custom_deleter)
bool is_timeinterval() const
bool is_dict_encoded_type() const
SQLTypeInfo(SQLTypes t, int d, int s, bool n)
Datum StringToDatum(std::string_view s, SQLTypeInfo &ti)
HostArrayDatum(size_t const l, int8_t *p, bool const n)
bool g_enable_smem_group_by true
void operator()(int8_t *p)
SQLTypeInfo(SQLTypes t, int d, int s, bool n, EncodingType c, int p, SQLTypes st)
std::string get_buffer_name() const
SQLTypeInfo(SQLTypes t, bool n, EncodingType c)
SQLTypeInfo get_array_type() const
int get_precision() const
void set_output_srid(int s)
SQLTypes decimal_to_int_type(const SQLTypeInfo &ti)
DEVICE DeviceArrayDatum()
HOST DEVICE bool is_null(const Datum &d) const
void set_comp_param(int p)
HOST DEVICE int get_storage_size() const
static std::string comp_name[kENCODING_LAST]
int8_t * appendDatum(int8_t *buf, Datum d, const SQLTypeInfo &ti)
HOST DEVICE EncodingType get_compression() const
bool is_date_in_days() const
int get_array_context_logical_size() const
int64_t convert_decimal_value_to_scale(const int64_t decimal_value, const SQLTypeInfo &type_info, const SQLTypeInfo &new_type_info)
void set_dimension(int d)
HOST DEVICE int get_dimension() const
std::string get_type_name() const
HOST DEVICE int get_comp_param() const
HOST DEVICE int get_input_srid() const
#define NULL_ARRAY_DOUBLE
virtual DEVICE ~VarlenDatum()
bool g_enable_watchdog false
bool is_high_precision_timestamp() const
HostArrayDatum(size_t const l, ManagedPtr p, bool const n)
#define NULL_ARRAY_BIGINT
bool is_dict_encoded_string() const
bool is_varlen_indeed() const
SQLTypeInfo(SQLTypes t, bool n)
HOST DEVICE bool get_notnull() const
bool is_string_array() const
SQLTypeInfo get_elem_type() const
int get_physical_coord_cols() const
void operator()(int8_t *)
#define TRANSIENT_DICT(ID)
void set_precision(int d)
SQLTypeInfo get_nullable_type_info(const SQLTypeInfo &type_info)
HOST DEVICE bool is_null_point_coord_array(const int8_t *val, int array_size) const
HOST DEVICE int get_output_srid() const
constexpr auto is_datetime(SQLTypes type)
HOST DEVICE bool is_null(const int8_t *val) const
HOST DEVICE void set_type(SQLTypes t)