25 #ifndef QUERYENGINE_RESULTSETBUFFERACCESSORS_H
26 #define QUERYENGINE_RESULTSETBUFFERACCESSORS_H
28 #include "../Shared/SqlTypesLayout.h"
46 const bool separate_varlen_storage) {
50 if (separate_varlen_storage && !target_info.
is_agg) {
58 const bool separate_varlen_storage) {
76 const bool separate_varlen_storage) {
84 const size_t slot_idx,
85 const size_t key_count,
86 const size_t slot_count) {
87 return (key_count + slot_count) * entry_idx + (key_count + slot_idx);
91 const size_t slot_idx,
92 const size_t key_count,
93 const size_t entry_count) {
94 return (key_count + slot_idx) * entry_count + entry_idx;
98 const size_t key_count,
99 const size_t slot_count) {
100 return (key_count + slot_count) * entry_idx;
104 const size_t key_idx,
105 const size_t entry_count) {
106 return key_idx * entry_count + entry_idx;
112 const size_t target_slot_idx) {
113 auto new_target_ptr = target_ptr;
118 return new_target_ptr;
132 CHECK(consist_key_width);
144 const size_t entry_idx) {
146 return buff + entry_idx * row_bytes;
152 const size_t slot_idx,
154 const bool separate_varlen_storage) {
157 ((!separate_varlen_storage || target_info.
is_agg) &&
162 (!separate_varlen_storage || target_info.
is_agg)) {
173 const size_t slot_idx,
175 const bool separate_varlen_storage) {
199 const bool float_argument_input) {
200 double dividend{0.0};
204 if (float_argument_input) {
205 dividend =
static_cast<double>(
206 *
reinterpret_cast<const float*
>(may_alias_ptr(&fp_pair.first)));
208 dividend = *
reinterpret_cast<const double*
>(may_alias_ptr(&fp_pair.first));
211 null_val = *
reinterpret_cast<const int64_t*
>(may_alias_ptr(&null_float));
215 dividend = *
reinterpret_cast<const double*
>(may_alias_ptr(&fp_pair.first));
217 null_val = *
reinterpret_cast<const int64_t*
>(may_alias_ptr(&null_double));
223 <<
"Unsupported type for pair to double conversion: " << ti.
get_type_name();
227 dividend =
static_cast<double>(fp_pair.first);
232 if (!ti.
get_notnull() && null_val == fp_pair.first) {
238 static_cast<double>(fp_pair.second)
239 : dividend / static_cast<double>(fp_pair.second);
243 const bool float_argument_input) {
246 int64_t float_null_val = 0;
247 *
reinterpret_cast<float*
>(may_alias_ptr(&float_null_val)) =
249 return float_null_val;
252 return *
reinterpret_cast<const int64_t*
>(may_alias_ptr(&double_null_val));
263 switch (compact_sz) {
265 return *
reinterpret_cast<const int64_t*
>(ptr);
268 return *
reinterpret_cast<const int32_t*
>(ptr);
271 return *
reinterpret_cast<const int16_t*
>(ptr);
274 return *
reinterpret_cast<const int8_t*
>(ptr);
283 #endif // QUERYENGINE_RESULTSETBUFFERACCESSORS_H
size_t slot_offset_rowwise(const size_t entry_idx, const size_t slot_idx, const size_t key_count, const size_t slot_count)
size_t getEntryCount() const
size_t slot_offset_colwise(const size_t entry_idx, const size_t slot_idx, const size_t key_count, const size_t entry_count)
T advance_to_next_columnar_target_buff(T target_ptr, const QueryMemoryDescriptor &query_mem_desc, const size_t target_slot_idx)
HOST DEVICE int get_scale() const
bool hasKeylessHash() const
size_t get_slot_off_quad(const QueryMemoryDescriptor &query_mem_desc)
size_t getEffectiveKeyWidth() const
int64_t read_int_from_buff(const int8_t *ptr, const int8_t compact_sz)
double pair_to_double(const std::pair< int64_t, int64_t > &fp_pair, const SQLTypeInfo &ti, const bool float_argument_input)
HOST DEVICE SQLTypes get_type() const
T advance_target_ptr_row_wise(T target_ptr, const TargetInfo &target_info, const size_t slot_idx, const QueryMemoryDescriptor &query_mem_desc, const bool separate_varlen_storage)
int64_t null_val_bit_pattern(const SQLTypeInfo &ti, const bool float_argument_input)
double inline_fp_null_val(const SQL_TYPE_INFO &ti)
size_t get_slots_for_geo_target(const TargetInfo &target_info, const bool separate_varlen_storage)
#define LOG_IF(severity, condition)
size_t advance_slot(const size_t j, const TargetInfo &target_info, const bool separate_varlen_storage)
size_t getGroupbyColCount() const
const int8_t getPaddedSlotWidthBytes(const size_t slot_idx) const
T row_ptr_rowwise(T buff, const QueryMemoryDescriptor &query_mem_desc, const size_t entry_idx)
size_t key_offset_colwise(const size_t entry_idx, const size_t key_idx, const size_t entry_count)
bool is_real_str_or_array(const TargetInfo &target_info)
HOST DEVICE EncodingType get_compression() const
size_t get_row_bytes(const QueryMemoryDescriptor &query_mem_desc)
std::string get_type_name() const
size_t key_offset_rowwise(const size_t entry_idx, const size_t key_count, const size_t slot_count)
Descriptor for the result set buffer layout.
bool didOutputColumnar() const
size_t getRowWidth() const
uint64_t exp_to_scale(const unsigned exp)
int64_t inline_int_null_val(const SQL_TYPE_INFO &ti)
T advance_target_ptr_col_wise(T target_ptr, const TargetInfo &target_info, const size_t slot_idx, const QueryMemoryDescriptor &query_mem_desc, const bool separate_varlen_storage)
HOST DEVICE bool get_notnull() const
size_t get_slots_for_target(const TargetInfo &target_info, const bool separate_varlen_storage)
T get_cols_ptr(T buff, const QueryMemoryDescriptor &query_mem_desc)
int get_physical_coord_cols() const
size_t getColOffInBytes(const size_t col_idx) const
size_t get_key_bytes_rowwise(const QueryMemoryDescriptor &query_mem_desc)
FORCE_INLINE HOST DEVICE T align_to_int64(T addr)