25 #include "../Logger/Logger.h"
34 #include <type_traits>
72 #if !(defined(__CUDACC__) || defined(NO_BOOST))
109 return "DAY TIME INTERVAL";
111 return "YEAR MONTH INTERVAL";
119 return "MULTIPOLYGON";
127 return "UNEVALUATED ANY";
135 return "COLUMN_LIST";
148 #endif // #if !(defined(__CUDACC__) || defined(NO_BOOST))
180 template <
typename CUSTOM_DELETER,
181 typename = std::enable_if_t<
182 std::is_void<std::result_of_t<CUSTOM_DELETER(int8_t*)> >::value> >
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)
208 std::conditional_t<is_cuda_compiler(), DeviceArrayDatum, HostArrayDatum>;
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))
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))
259 #define TRANSIENT_DICT_ID 0
260 #define TRANSIENT_DICT(ID) (-(ID))
261 #define REGULAR_DICT(TRANSIENTID) (-(TRANSIENTID))
445 std::string srid_string =
"";
463 return elem_ti.get_type_name() + ps +
"[" + num_elems +
"]";
470 return "COLUMN<" +
type_name[
static_cast<int>(
subtype)] + ps +
">" + num_elems;
477 return "COLUMN_LIST<" +
type_name[
static_cast<int>(
subtype)] + ps +
">" + num_elems;
484 std::ostringstream oss;
487 <<
", null=" << (
get_notnull() ?
"not nullable" :
"nullable")
589 return sizeof(int32_t);
653 const auto& new_type = new_type_info.
get_type();
663 if (new_type_info.
is_fp()) {
672 if (!new_type_info.
is_fp()) {
695 return new_type ==
kDATE;
697 return new_type ==
kTIME;
821 if (
type ==
kARRAY && val && array_size > 0 && array_size ==
size) {
826 elem_ti.set_subtype(
kNULLT);
827 auto elem_size = elem_ti.get_storage_size();
853 int array_size)
const {
855 array_size ==
size) {
856 if (array_size == 2 *
sizeof(
double)) {
859 if (array_size == 2 *
sizeof(int32_t)) {
915 return sizeof(int8_t);
917 return sizeof(int8_t);
921 return sizeof(int16_t);
935 return sizeof(int32_t);
952 return sizeof(int64_t);
966 return sizeof(float);
980 return sizeof(double);
998 return sizeof(int64_t);
1028 return sizeof(int32_t);
1053 #include <string_view>
1065 #include "../QueryEngine/DateAdd.h"
1066 #include "../QueryEngine/DateTruncate.h"
1067 #include "../QueryEngine/ExtractFromTime.h"
1080 #if !(defined(__CUDACC__) || defined(NO_BOOST))
1081 UNREACHABLE() <<
"Invalid number of bytes=" << nbytes;
1105 return nullable_type_info;
1120 ti.set_subtype(subtype);
1126 ti.set_subtype(subtype);
1132 ti.set_subtype(subtype);
1133 ti.set_compression(c);
1134 ti.set_comp_param(p);
1140 ti.set_subtype(subtype);
HOST DEVICE SQLTypes get_subtype() const
void set_compression(EncodingType c)
HOST DEVICE int get_size() const
HOST DEVICE void operator=(const SQLTypeInfo &rhs)
int8_t * append_datum(int8_t *buf, const Datum &d, const SQLTypeInfo &ti)
std::string DatumToString(Datum d, const SQLTypeInfo &ti)
bool is_varlen_array() const
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
std::ostream & operator<<(std::ostream &os, const SessionInfo &session_info)
HOST DEVICE int get_scale() const
#define NULL_ARRAY_SMALLINT
auto generate_column_type(const SQLTypes subtype)
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)
bool is_subtype_dict_encoded_string() const
int64_t extract_int_type_from_datum(const Datum datum, const SQLTypeInfo &ti)
#define NULL_ARRAY_COMPRESSED_32
HostArrayDatum(size_t const l, int8_t *p, CUSTOM_DELETER custom_deleter)
bool is_timeinterval() const
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...
int is_logical_geo_type() const
auto generate_column_list_type(const SQLTypes subtype)
bool is_dict_intersection() const
bool is_dict_encoded_type() const
SQLTypeInfo(SQLTypes t, int d, int s, bool n)
Datum StringToDatum(std::string_view s, SQLTypeInfo &ti)
std::string toString() const
HostArrayDatum(size_t const l, int8_t *p, bool const n)
bool g_enable_smem_group_by true
std::string toString(const Executor::ExtModuleKinds &kind)
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)
auto generate_array_type(const SQLTypes subtype)
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]
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)
SQLTypes get_int_type_by_size(size_t const nbytes)
bool is_none_encoded_string() const
HOST DEVICE int get_dimension() const
std::string get_type_name() const
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...
HOST DEVICE int get_comp_param() const
HOST DEVICE int get_input_srid() const
void set_dict_intersection()
#define NULL_ARRAY_DOUBLE
virtual DEVICE ~VarlenDatum()
bool is_column_list() const
bool g_enable_watchdog false
bool is_high_precision_timestamp() const
double extract_fp_type_from_datum(const Datum datum, const SQLTypeInfo &ti)
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, EncodingType c, int p, SQLTypes st)
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
SQLTypes string_dict_to_int_type(const SQLTypeInfo &ti)
HOST DEVICE void set_type(SQLTypes t)