OmniSciDB  04ee39c94c
ResultSetBufferAccessors.h File Reference

Utility functions for easy access to the result set buffers. More...

#include "../Shared/SqlTypesLayout.h"
#include "BufferCompaction.h"
#include "TypePunning.h"
#include "Descriptors/QueryMemoryDescriptor.h"
#include <algorithm>
+ Include dependency graph for ResultSetBufferAccessors.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

bool is_real_str_or_array (const TargetInfo &target_info)
 
size_t get_slots_for_geo_target (const TargetInfo &target_info, const bool separate_varlen_storage)
 
size_t get_slots_for_target (const TargetInfo &target_info, const bool separate_varlen_storage)
 
size_t advance_slot (const size_t j, const TargetInfo &target_info, const bool separate_varlen_storage)
 
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 slot_offset_colwise (const size_t entry_idx, const size_t slot_idx, const size_t key_count, const size_t entry_count)
 
size_t key_offset_rowwise (const size_t entry_idx, const size_t key_count, const size_t slot_count)
 
size_t key_offset_colwise (const size_t entry_idx, const size_t key_idx, const size_t entry_count)
 
template<class T >
advance_to_next_columnar_target_buff (T target_ptr, const QueryMemoryDescriptor &query_mem_desc, const size_t target_slot_idx)
 
template<class T >
get_cols_ptr (T buff, const QueryMemoryDescriptor &query_mem_desc)
 
size_t get_key_bytes_rowwise (const QueryMemoryDescriptor &query_mem_desc)
 
size_t get_row_bytes (const QueryMemoryDescriptor &query_mem_desc)
 
template<class T >
row_ptr_rowwise (T buff, const QueryMemoryDescriptor &query_mem_desc, const size_t entry_idx)
 
template<class 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)
 
template<class 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)
 
size_t get_slot_off_quad (const QueryMemoryDescriptor &query_mem_desc)
 
double pair_to_double (const std::pair< int64_t, int64_t > &fp_pair, const SQLTypeInfo &ti, const bool float_argument_input)
 
int64_t null_val_bit_pattern (const SQLTypeInfo &ti, const bool float_argument_input)
 
int64_t read_int_from_buff (const int8_t *ptr, const int8_t compact_sz)
 

Detailed Description

Utility functions for easy access to the result set buffers.

Author
Alex Suhan alex@.nosp@m.mapd.nosp@m..com Copyright (c) 2014 MapD Technologies, Inc. All rights reserved.

Definition in file ResultSetBufferAccessors.h.

Function Documentation

◆ advance_slot()

size_t advance_slot ( const size_t  j,
const TargetInfo target_info,
const bool  separate_varlen_storage 
)
inline

Definition at line 74 of file ResultSetBufferAccessors.h.

References get_slots_for_geo_target(), get_slots_for_target(), SQLTypeInfoCore< TYPE_FACET_PACK >::is_geometry(), and TargetInfo::sql_type.

Referenced by anonymous_namespace{ResultSetIteration.cpp}::advance_col_buff_to_slot(), fill_one_entry_baseline(), fill_one_entry_no_collisions(), fill_storage_buffer_perfect_hash_colwise(), get_byteoff_of_slot(), get_heap_key_slot_index(), get_slot_count(), get_slot_to_target_mapping(), ResultSet::getSlotIndicesForTargetIndices(), ResultSet::RowWiseTargetAccessor::initializeOffsetsForStorage(), ResultSet::ColumnWiseTargetAccessor::initializeOffsetsForStorage(), ResultSetReductionJIT::reduceOneEntryBaseline(), ResultSetStorage::reduceOneEntrySlotsBaseline(), ResultSetStorage::rewriteAggregateBufferOffsets(), and anonymous_namespace{ResultSetTest.cpp}::ResultSetEmulator::rse_fill_storage_buffer_perfect_hash_colwise().

76  {
77  if (target_info.sql_type.is_geometry()) {
78  return j + get_slots_for_geo_target(target_info, separate_varlen_storage);
79  }
80  return j + get_slots_for_target(target_info, separate_varlen_storage);
81 }
SQLTypeInfo sql_type
Definition: TargetInfo.h:42
size_t get_slots_for_geo_target(const TargetInfo &target_info, const bool separate_varlen_storage)
bool is_geometry() const
Definition: sqltypes.h:462
size_t get_slots_for_target(const TargetInfo &target_info, const bool separate_varlen_storage)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ advance_target_ptr_col_wise()

template<class T >
T advance_target_ptr_col_wise ( target_ptr,
const TargetInfo target_info,
const size_t  slot_idx,
const QueryMemoryDescriptor query_mem_desc,
const bool  separate_varlen_storage 
)
inline

Definition at line 171 of file ResultSetBufferAccessors.h.

References advance_to_next_columnar_target_buff(), TargetInfo::agg_kind, SQLTypeInfoCore< TYPE_FACET_PACK >::get_physical_coord_cols(), TargetInfo::is_agg, SQLTypeInfoCore< TYPE_FACET_PACK >::is_geometry(), is_real_str_or_array(), kAVG, run-benchmark-import::result, and TargetInfo::sql_type.

Referenced by get_byteoff_of_slot().

175  {
176  auto result =
177  advance_to_next_columnar_target_buff(target_ptr, query_mem_desc, slot_idx);
178  if ((target_info.is_agg && target_info.agg_kind == kAVG) ||
179  (is_real_str_or_array(target_info) && !separate_varlen_storage)) {
180  return advance_to_next_columnar_target_buff(result, query_mem_desc, slot_idx + 1);
181  } else if (target_info.sql_type.is_geometry() && !separate_varlen_storage) {
182  for (auto i = 1; i < 2 * target_info.sql_type.get_physical_coord_cols(); ++i) {
183  result = advance_to_next_columnar_target_buff(result, query_mem_desc, slot_idx + i);
184  }
185  return result;
186  } else {
187  return result;
188  }
189 }
int get_physical_coord_cols() const
Definition: sqltypes.h:359
T advance_to_next_columnar_target_buff(T target_ptr, const QueryMemoryDescriptor &query_mem_desc, const size_t target_slot_idx)
SQLTypeInfo sql_type
Definition: TargetInfo.h:42
bool is_agg
Definition: TargetInfo.h:40
SQLAgg agg_kind
Definition: TargetInfo.h:41
bool is_real_str_or_array(const TargetInfo &target_info)
bool is_geometry() const
Definition: sqltypes.h:462
Definition: sqldefs.h:71
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ advance_target_ptr_row_wise()

template<class T >
T advance_target_ptr_row_wise ( target_ptr,
const TargetInfo target_info,
const size_t  slot_idx,
const QueryMemoryDescriptor query_mem_desc,
const bool  separate_varlen_storage 
)
inline

Definition at line 150 of file ResultSetBufferAccessors.h.

References TargetInfo::agg_kind, SQLTypeInfoCore< TYPE_FACET_PACK >::get_physical_coord_cols(), QueryMemoryDescriptor::getPaddedSlotWidthBytes(), TargetInfo::is_agg, SQLTypeInfoCore< TYPE_FACET_PACK >::is_geometry(), is_real_str_or_array(), kAVG, run-benchmark-import::result, and TargetInfo::sql_type.

Referenced by get_byteoff_of_slot(), ResultSet::RowWiseTargetAccessor::initializeOffsetsForStorage(), and ResultSetStorage::rewriteAggregateBufferOffsets().

154  {
155  auto result = target_ptr + query_mem_desc.getPaddedSlotWidthBytes(slot_idx);
156  if ((target_info.is_agg && target_info.agg_kind == kAVG) ||
157  ((!separate_varlen_storage || target_info.is_agg) &&
158  is_real_str_or_array(target_info))) {
159  return result + query_mem_desc.getPaddedSlotWidthBytes(slot_idx + 1);
160  }
161  if (target_info.sql_type.is_geometry() &&
162  (!separate_varlen_storage || target_info.is_agg)) {
163  for (auto i = 1; i < 2 * target_info.sql_type.get_physical_coord_cols(); ++i) {
164  result += query_mem_desc.getPaddedSlotWidthBytes(slot_idx + i);
165  }
166  }
167  return result;
168 }
int get_physical_coord_cols() const
Definition: sqltypes.h:359
SQLTypeInfo sql_type
Definition: TargetInfo.h:42
const int8_t getPaddedSlotWidthBytes(const size_t slot_idx) const
bool is_agg
Definition: TargetInfo.h:40
SQLAgg agg_kind
Definition: TargetInfo.h:41
bool is_real_str_or_array(const TargetInfo &target_info)
bool is_geometry() const
Definition: sqltypes.h:462
Definition: sqldefs.h:71
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ advance_to_next_columnar_target_buff()

template<class T >
T advance_to_next_columnar_target_buff ( target_ptr,
const QueryMemoryDescriptor query_mem_desc,
const size_t  target_slot_idx 
)
inline

Definition at line 110 of file ResultSetBufferAccessors.h.

References align_to_int64(), QueryMemoryDescriptor::getEntryCount(), and QueryMemoryDescriptor::getPaddedSlotWidthBytes().

Referenced by anonymous_namespace{ResultSetIteration.cpp}::advance_col_buff_to_slot(), advance_target_ptr_col_wise(), fill_storage_buffer_perfect_hash_colwise(), ResultSet::getTargetValueFromBufferColwise(), ResultSet::ColumnWiseTargetAccessor::initializeOffsetsForStorage(), ResultSet::makeGeoTargetValue(), ResultSetStorage::reduceEntriesNoCollisionsColWise(), and anonymous_namespace{ResultSetTest.cpp}::ResultSetEmulator::rse_fill_storage_buffer_perfect_hash_colwise().

112  {
113  auto new_target_ptr = target_ptr;
114  const auto column_size = query_mem_desc.getEntryCount() *
115  query_mem_desc.getPaddedSlotWidthBytes(target_slot_idx);
116  new_target_ptr += align_to_int64(column_size);
117 
118  return new_target_ptr;
119 }
const int8_t getPaddedSlotWidthBytes(const size_t slot_idx) const
FORCE_INLINE HOST DEVICE T align_to_int64(T addr)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get_cols_ptr()

template<class T >
T get_cols_ptr ( buff,
const QueryMemoryDescriptor query_mem_desc 
)
inline

Definition at line 122 of file ResultSetBufferAccessors.h.

References CHECK, QueryMemoryDescriptor::didOutputColumnar(), and QueryMemoryDescriptor::getColOffInBytes().

Referenced by anonymous_namespace{ResultSetIteration.cpp}::advance_col_buff_to_slot(), get_byteoff_of_slot(), ResultSet::ColumnWiseTargetAccessor::initializeOffsetsForStorage(), and ResultSetStorage::reduceEntriesNoCollisionsColWise().

122  {
123  CHECK(query_mem_desc.didOutputColumnar());
124  return buff + query_mem_desc.getColOffInBytes(0);
125 }
#define CHECK(condition)
Definition: Logger.h:187
size_t getColOffInBytes(const size_t col_idx) const
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get_key_bytes_rowwise()

size_t get_key_bytes_rowwise ( const QueryMemoryDescriptor query_mem_desc)
inline

Definition at line 127 of file ResultSetBufferAccessors.h.

References CHECK, QueryMemoryDescriptor::getEffectiveKeyWidth(), QueryMemoryDescriptor::groupColWidthsSize(), and QueryMemoryDescriptor::hasKeylessHash().

Referenced by get_byteoff_of_slot(), get_row_bytes(), get_slot_off_quad(), ResultSet::getOneColRow(), ResultSetStorage::initializeRowWise(), ResultSetReductionJIT::reduceOneEntryNoCollisions(), ResultSetStorage::reduceOneEntryNoCollisionsRowWise(), and ResultSetStorage::rewriteAggregateBufferOffsets().

127  {
128  if (query_mem_desc.hasKeylessHash()) {
129  return 0;
130  }
131  auto consist_key_width = query_mem_desc.getEffectiveKeyWidth();
132  CHECK(consist_key_width);
133  return consist_key_width * query_mem_desc.groupColWidthsSize();
134 }
#define CHECK(condition)
Definition: Logger.h:187
size_t getEffectiveKeyWidth() const
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get_row_bytes()

size_t get_row_bytes ( const QueryMemoryDescriptor query_mem_desc)
inline

Definition at line 136 of file ResultSetBufferAccessors.h.

References align_to_int64(), get_key_bytes_rowwise(), QueryMemoryDescriptor::getRowWidth(), and run-benchmark-import::result.

Referenced by anonymous_namespace{ResultSetBaselineRadixSortTest.cpp}::fill_storage_buffer_baseline_sort_int(), anonymous_namespace{ResultSetReduction.cpp}::get_row_qw_count(), ResultSetStorage::initializeRowWise(), ResultSetReductionJIT::reduceOneEntryBaselineIdx(), ResultSetReductionJIT::reduceOneEntryNoCollisionsIdx(), and row_ptr_rowwise().

136  {
137  size_t result = align_to_int64(get_key_bytes_rowwise(query_mem_desc)); // plus padding
138  return result + query_mem_desc.getRowWidth();
139 }
size_t get_key_bytes_rowwise(const QueryMemoryDescriptor &query_mem_desc)
FORCE_INLINE HOST DEVICE T align_to_int64(T addr)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get_slot_off_quad()

size_t get_slot_off_quad ( const QueryMemoryDescriptor query_mem_desc)
inline

Definition at line 191 of file ResultSetBufferAccessors.h.

References align_to_int64(), and get_key_bytes_rowwise().

Referenced by anonymous_namespace{ResultSetReduction.cpp}::fill_slots(), anonymous_namespace{ResultSetBaselineRadixSortTest.cpp}::fill_storage_buffer_baseline_sort_int(), anonymous_namespace{ResultSetReduction.cpp}::get_matching_group_value_reduction(), ResultSetReductionJIT::reduceOneEntryBaselineIdx(), and ResultSetStorage::reduceOneEntrySlotsBaseline().

191  {
192  return align_to_int64(get_key_bytes_rowwise(query_mem_desc)) / sizeof(int64_t);
193 }
size_t get_key_bytes_rowwise(const QueryMemoryDescriptor &query_mem_desc)
FORCE_INLINE HOST DEVICE T align_to_int64(T addr)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get_slots_for_geo_target()

size_t get_slots_for_geo_target ( const TargetInfo target_info,
const bool  separate_varlen_storage 
)
inline

Definition at line 45 of file ResultSetBufferAccessors.h.

References SQLTypeInfoCore< TYPE_FACET_PACK >::get_physical_coord_cols(), TargetInfo::is_agg, and TargetInfo::sql_type.

Referenced by advance_slot().

46  {
47  // Aggregates on geospatial types are serialized directly by rewriting the underlying
48  // buffer. Even if separate varlen storage is valid, treat aggregates the same on
49  // distributed and single node
50  if (separate_varlen_storage && !target_info.is_agg) {
51  return 1;
52  } else {
53  return 2 * target_info.sql_type.get_physical_coord_cols();
54  }
55 }
int get_physical_coord_cols() const
Definition: sqltypes.h:359
SQLTypeInfo sql_type
Definition: TargetInfo.h:42
bool is_agg
Definition: TargetInfo.h:40
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get_slots_for_target()

size_t get_slots_for_target ( const TargetInfo target_info,
const bool  separate_varlen_storage 
)
inline

Definition at line 57 of file ResultSetBufferAccessors.h.

References TargetInfo::agg_kind, TargetInfo::is_agg, is_real_str_or_array(), and kAVG.

Referenced by advance_slot().

58  {
59  if (target_info.is_agg) {
60  if (target_info.agg_kind == kAVG || is_real_str_or_array(target_info)) {
61  return 2;
62  } else {
63  return 1;
64  }
65  } else {
66  if (is_real_str_or_array(target_info) && !separate_varlen_storage) {
67  return 2;
68  } else {
69  return 1;
70  }
71  }
72 }
bool is_agg
Definition: TargetInfo.h:40
SQLAgg agg_kind
Definition: TargetInfo.h:41
bool is_real_str_or_array(const TargetInfo &target_info)
Definition: sqldefs.h:71
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ is_real_str_or_array()

bool is_real_str_or_array ( const TargetInfo target_info)
inline

Definition at line 38 of file ResultSetBufferAccessors.h.

References TargetInfo::agg_kind, SQLTypeInfoCore< TYPE_FACET_PACK >::get_compression(), TargetInfo::is_agg, SQLTypeInfoCore< TYPE_FACET_PACK >::is_array(), SQLTypeInfoCore< TYPE_FACET_PACK >::is_string(), kENCODING_NONE, kSAMPLE, and TargetInfo::sql_type.

Referenced by advance_target_ptr_col_wise(), advance_target_ptr_row_wise(), get_slots_for_target(), ResultSet::getTargetValueFromBufferColwise(), ResultSet::getTargetValueFromBufferRowwise(), ResultSet::RowWiseTargetAccessor::initializeOffsetsForStorage(), ResultSet::ColumnWiseTargetAccessor::initializeOffsetsForStorage(), and anonymous_namespace{QueryMemoryDescriptor.cpp}::target_expr_proj_indices().

38  {
39  return (!target_info.is_agg || target_info.agg_kind == kSAMPLE) &&
40  (target_info.sql_type.is_array() ||
41  (target_info.sql_type.is_string() &&
42  target_info.sql_type.get_compression() == kENCODING_NONE));
43 }
SQLTypeInfo sql_type
Definition: TargetInfo.h:42
HOST DEVICE EncodingType get_compression() const
Definition: sqltypes.h:331
bool is_array() const
Definition: sqltypes.h:458
bool is_agg
Definition: TargetInfo.h:40
SQLAgg agg_kind
Definition: TargetInfo.h:41
bool is_string() const
Definition: sqltypes.h:450
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ key_offset_colwise()

size_t key_offset_colwise ( const size_t  entry_idx,
const size_t  key_idx,
const size_t  entry_count 
)
inline

Definition at line 103 of file ResultSetBufferAccessors.h.

Referenced by fill_storage_buffer_baseline_colwise(), ResultSetStorage::fillOneEntryColWise(), ResultSetStorage::initializeColWise(), ResultSetStorage::moveOneEntryToBuffer(), ResultSetStorage::reduceOneEntryBaseline(), and anonymous_namespace{ResultSetTest.cpp}::ResultSetEmulator::rse_fill_storage_buffer_baseline_colwise().

105  {
106  return key_idx * entry_count + entry_idx;
107 }
+ Here is the caller graph for this function:

◆ key_offset_rowwise()

size_t key_offset_rowwise ( const size_t  entry_idx,
const size_t  key_count,
const size_t  slot_count 
)
inline

Definition at line 97 of file ResultSetBufferAccessors.h.

Referenced by fill_storage_buffer_baseline_rowwise(), anonymous_namespace{ResultSetBaselineRadixSortTest.cpp}::fill_storage_buffer_baseline_sort_fp(), ResultSetStorage::fillOneEntryRowWise(), and anonymous_namespace{ResultSetTest.cpp}::ResultSetEmulator::rse_fill_storage_buffer_baseline_rowwise().

99  {
100  return (key_count + slot_count) * entry_idx;
101 }
+ Here is the caller graph for this function:

◆ null_val_bit_pattern()

int64_t null_val_bit_pattern ( const SQLTypeInfo ti,
const bool  float_argument_input 
)
inline

Definition at line 242 of file ResultSetBufferAccessors.h.

References SQLTypeInfoCore< TYPE_FACET_PACK >::get_compression(), SQLTypeInfoCore< TYPE_FACET_PACK >::get_type(), inline_fp_null_val(), inline_int_null_val(), SQLTypeInfoCore< TYPE_FACET_PACK >::is_array(), SQLTypeInfoCore< TYPE_FACET_PACK >::is_fp(), SQLTypeInfoCore< TYPE_FACET_PACK >::is_geometry(), SQLTypeInfoCore< TYPE_FACET_PACK >::is_string(), kENCODING_NONE, and kFLOAT.

Referenced by fill_one_entry_baseline(), anonymous_namespace{ResultSetBaselineRadixSortTest.cpp}::fill_storage_buffer_baseline_sort_fp(), anonymous_namespace{ResultSetBaselineRadixSortTest.cpp}::fill_storage_buffer_baseline_sort_int(), anonymous_namespace{WindowContext.cpp}::fp_comparator(), ResultSet::isNull(), and ResultSetStorage::ResultSetStorage().

243  {
244  if (ti.is_fp()) {
245  if (float_argument_input && ti.get_type() == kFLOAT) {
246  int64_t float_null_val = 0;
247  *reinterpret_cast<float*>(may_alias_ptr(&float_null_val)) =
248  static_cast<float>(inline_fp_null_val(ti));
249  return float_null_val;
250  }
251  const auto double_null_val = inline_fp_null_val(ti);
252  return *reinterpret_cast<const int64_t*>(may_alias_ptr(&double_null_val));
253  }
254  if ((ti.is_string() && ti.get_compression() == kENCODING_NONE) || ti.is_array() ||
255  ti.is_geometry()) {
256  return 0;
257  }
258  return inline_int_null_val(ti);
259 }
bool is_fp() const
Definition: sqltypes.h:454
HOST DEVICE SQLTypes get_type() const
Definition: sqltypes.h:323
HOST DEVICE EncodingType get_compression() const
Definition: sqltypes.h:331
double inline_fp_null_val(const SQL_TYPE_INFO &ti)
bool is_array() const
Definition: sqltypes.h:458
int64_t inline_int_null_val(const SQL_TYPE_INFO &ti)
bool is_geometry() const
Definition: sqltypes.h:462
bool is_string() const
Definition: sqltypes.h:450
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ pair_to_double()

double pair_to_double ( const std::pair< int64_t, int64_t > &  fp_pair,
const SQLTypeInfo ti,
const bool  float_argument_input 
)
inline

Definition at line 197 of file ResultSetBufferAccessors.h.

References CHECK, exp_to_scale(), logger::FATAL, SQLTypeInfoCore< TYPE_FACET_PACK >::get_notnull(), SQLTypeInfoCore< TYPE_FACET_PACK >::get_scale(), SQLTypeInfoCore< TYPE_FACET_PACK >::get_type(), SQLTypeInfoCore< TYPE_FACET_PACK >::get_type_name(), inline_fp_null_val(), inline_int_null_val(), SQLTypeInfoCore< TYPE_FACET_PACK >::is_decimal(), SQLTypeInfoCore< TYPE_FACET_PACK >::is_integer(), kDOUBLE, kFLOAT, and LOG_IF.

Referenced by ResultSet::isNull(), anonymous_namespace{ResultSetIteration.cpp}::make_avg_target_value(), and ResultSet::ResultSetComparator< BUFFER_ITERATOR_TYPE >::operator()().

199  {
200  double dividend{0.0};
201  int64_t null_val{0};
202  switch (ti.get_type()) {
203  case kFLOAT: {
204  if (float_argument_input) {
205  dividend = static_cast<double>(
206  *reinterpret_cast<const float*>(may_alias_ptr(&fp_pair.first)));
207  } else {
208  dividend = *reinterpret_cast<const double*>(may_alias_ptr(&fp_pair.first));
209  }
210  double null_float = inline_fp_null_val(ti);
211  null_val = *reinterpret_cast<const int64_t*>(may_alias_ptr(&null_float));
212  break;
213  }
214  case kDOUBLE: {
215  dividend = *reinterpret_cast<const double*>(may_alias_ptr(&fp_pair.first));
216  double null_double = inline_fp_null_val(ti);
217  null_val = *reinterpret_cast<const int64_t*>(may_alias_ptr(&null_double));
218  break;
219  }
220  default: {
221 #ifndef __CUDACC__
222  LOG_IF(FATAL, !(ti.is_integer() || ti.is_decimal()))
223  << "Unsupported type for pair to double conversion: " << ti.get_type_name();
224 #else
225  CHECK(ti.is_integer() || ti.is_decimal());
226 #endif
227  dividend = static_cast<double>(fp_pair.first);
228  null_val = inline_int_null_val(ti);
229  break;
230  }
231  }
232  if (!ti.get_notnull() && null_val == fp_pair.first) {
233  return inline_fp_null_val(SQLTypeInfo(kDOUBLE, false));
234  }
235 
236  return ti.is_integer() || ti.is_decimal()
237  ? (dividend / exp_to_scale(ti.is_decimal() ? ti.get_scale() : 0)) /
238  static_cast<double>(fp_pair.second)
239  : dividend / static_cast<double>(fp_pair.second);
240 }
HOST DEVICE bool get_notnull() const
Definition: sqltypes.h:330
HOST DEVICE int get_scale() const
Definition: sqltypes.h:328
HOST DEVICE SQLTypes get_type() const
Definition: sqltypes.h:323
double inline_fp_null_val(const SQL_TYPE_INFO &ti)
#define LOG_IF(severity, condition)
Definition: Logger.h:273
std::string get_type_name() const
Definition: sqltypes.h:426
bool is_integer() const
Definition: sqltypes.h:452
bool is_decimal() const
Definition: sqltypes.h:453
SQLTypeInfoCore< ArrayContextTypeSizer, ExecutorTypePackaging, DateTimeFacilities > SQLTypeInfo
Definition: sqltypes.h:823
#define CHECK(condition)
Definition: Logger.h:187
uint64_t exp_to_scale(const unsigned exp)
int64_t inline_int_null_val(const SQL_TYPE_INFO &ti)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ read_int_from_buff()

int64_t read_int_from_buff ( const int8_t *  ptr,
const int8_t  compact_sz 
)
inline

Definition at line 262 of file ResultSetBufferAccessors.h.

References UNREACHABLE.

Referenced by ResultSet::RowWiseTargetAccessor::getColumnInternal(), ResultSet::ColumnWiseTargetAccessor::getColumnInternal(), ResultSetStorage::isEmptyEntry(), ResultSetStorage::isEmptyEntryColumnar(), anonymous_namespace{ResultSetIteration.cpp}::make_avg_target_value(), ResultSet::makeGeoTargetValue(), ResultSet::makeTargetValue(), and ResultSet::makeVarlenTargetValue().

262  {
263  switch (compact_sz) {
264  case 8: {
265  return *reinterpret_cast<const int64_t*>(ptr);
266  }
267  case 4: {
268  return *reinterpret_cast<const int32_t*>(ptr);
269  }
270  case 2: {
271  return *reinterpret_cast<const int16_t*>(ptr);
272  }
273  case 1: {
274  return *reinterpret_cast<const int8_t*>(ptr);
275  }
276  default:
277  UNREACHABLE();
278  }
279  UNREACHABLE();
280  return 0;
281 }
#define UNREACHABLE()
Definition: Logger.h:231
+ Here is the caller graph for this function:

◆ row_ptr_rowwise()

template<class T >
T row_ptr_rowwise ( buff,
const QueryMemoryDescriptor query_mem_desc,
const size_t  entry_idx 
)
inline

Definition at line 142 of file ResultSetBufferAccessors.h.

References get_row_bytes().

Referenced by get_byteoff_of_slot(), ResultSet::getOneColRow(), ResultSetStorage::isEmptyEntry(), ResultSetStorage::reduceOneEntryNoCollisionsRowWise(), and ResultSetStorage::rewriteAggregateBufferOffsets().

144  {
145  const auto row_bytes = get_row_bytes(query_mem_desc);
146  return buff + entry_idx * row_bytes;
147 }
size_t get_row_bytes(const QueryMemoryDescriptor &query_mem_desc)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ slot_offset_colwise()

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 
)
inline

Definition at line 90 of file ResultSetBufferAccessors.h.

Referenced by anonymous_namespace{ResultSetReduction.cpp}::fill_slots(), fill_storage_buffer_baseline_colwise(), ResultSetStorage::fillOneEntryColWise(), ResultSetStorage::initializeColWise(), ResultSetStorage::reduceOneEntrySlotsBaseline(), and anonymous_namespace{ResultSetTest.cpp}::ResultSetEmulator::rse_fill_storage_buffer_baseline_colwise().

93  {
94  return (key_count + slot_idx) * entry_count + entry_idx;
95 }
+ Here is the caller graph for this function:

◆ slot_offset_rowwise()

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 
)
inline

Definition at line 83 of file ResultSetBufferAccessors.h.

Referenced by fill_storage_buffer_baseline_rowwise(), anonymous_namespace{ResultSetBaselineRadixSortTest.cpp}::fill_storage_buffer_baseline_sort_fp(), ResultSetStorage::fillOneEntryRowWise(), and anonymous_namespace{ResultSetTest.cpp}::ResultSetEmulator::rse_fill_storage_buffer_baseline_rowwise().

86  {
87  return (key_count + slot_count) * entry_idx + (key_count + slot_idx);
88 }
+ Here is the caller graph for this function: