OmniSciDB  a5dc49c757
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ColSlotContext Class Reference

#include <ColSlotContext.h>

Public Member Functions

 ColSlotContext ()
 
 ColSlotContext (const std::vector< Analyzer::Expr * > &col_expr_list, const std::vector< int64_t > &col_exprs_to_not_project)
 
void setAllSlotsSize (const int8_t slot_width_size)
 
void setAllSlotsPaddedSize (const int8_t padded_size)
 
void setAllUnsetSlotsPaddedSize (const int8_t padded_size)
 
void setAllSlotsPaddedSizeToLogicalSize ()
 
void validate () const
 
size_t getColCount () const
 
size_t getSlotCount () const
 
const SlotSizegetSlotInfo (const size_t slot_idx) const
 
void setPaddedSlotWidthBytes (const size_t slot_idx, const int8_t bytes)
 
const std::vector< size_t > & getSlotsForCol (const size_t col_idx) const
 
size_t getAllSlotsPaddedSize () const
 
size_t getAllSlotsAlignedPaddedSize () const
 
size_t getAlignedPaddedSizeForRange (const size_t end) const
 
size_t getTotalBytesOfColumnarBuffers (const size_t entry_count) const
 
int8_t getMinPaddedByteSize (const int8_t actual_min_byte_width) const
 
size_t getCompactByteWidth () const
 
size_t getColOnlyOffInBytes (const size_t slot_idx) const
 
bool empty ()
 
void clear ()
 
void addColumn (const std::vector< std::tuple< int8_t, int8_t >> &slots_for_col)
 
void addColumnFlatBuffer (const int64_t flatbuffer_size)
 
int64_t getFlatBufferSize (const size_t slot_idx) const
 
bool operator== (const ColSlotContext &that) const
 
bool operator!= (const ColSlotContext &that) const
 
void alignPaddedSlots (const bool sort_on_gpu)
 
int64_t varlenOutputElementSize (const size_t slot_idx) const
 
bool hasVarlenOutput () const
 
bool slotIsVarlen (const size_t slot_idx) const
 
bool checkSlotUsesFlatBufferFormat (const size_t slot_idx) const
 
std::string toString () const
 

Private Types

using ArraySize = int64_t
 
using SlotIndex = size_t
 

Private Member Functions

void addSlotForColumn (const int8_t logical_size, const size_t column_idx)
 
void addSlotForColumn (const int8_t padded_size, const int8_t logical_size, const size_t column_idx)
 

Private Attributes

std::vector< SlotSizeslot_sizes_
 
std::vector< std::vector
< size_t > > 
col_to_slot_map_
 
std::unordered_map< SlotIndex,
ArraySize
varlen_output_slot_map_
 

Detailed Description

Definition at line 46 of file ColSlotContext.h.

Member Typedef Documentation

using ColSlotContext::ArraySize = int64_t
private

Definition at line 159 of file ColSlotContext.h.

using ColSlotContext::SlotIndex = size_t
private

Definition at line 160 of file ColSlotContext.h.

Constructor & Destructor Documentation

ColSlotContext::ColSlotContext ( )
inline

Definition at line 48 of file ColSlotContext.h.

48 {}
ColSlotContext::ColSlotContext ( const std::vector< Analyzer::Expr * > &  col_expr_list,
const std::vector< int64_t > &  col_exprs_to_not_project 
)

Definition at line 35 of file ColSlotContext.cpp.

References addSlotForColumn(), CHECK, CHECK_EQ, col_to_slot_map_, g_bigint_count, get_bit_width(), get_compact_type(), get_target_info(), kAVG, kENCODING_GEOINT, kENCODING_NONE, kPOINT, slot_sizes_, and varlen_output_slot_map_.

36  {
37  // Note that non-projected col exprs could be projected cols that we can lazy fetch or
38  // grouped cols with keyless hash
39  if (!col_exprs_to_not_project.empty()) {
40  CHECK_EQ(col_expr_list.size(), col_exprs_to_not_project.size());
41  }
42  size_t col_expr_idx = 0;
43  col_to_slot_map_.resize(col_expr_list.size());
44  for (const auto col_expr : col_expr_list) {
45  if (!col_exprs_to_not_project.empty() &&
46  col_exprs_to_not_project[col_expr_idx] != -1) {
47  addSlotForColumn(0, 0, col_expr_idx);
48  ++col_expr_idx;
49  continue;
50  }
51  if (!col_expr) {
52  // row index
53  addSlotForColumn(sizeof(int64_t), col_expr_idx);
54  } else {
55  const auto agg_info = get_target_info(col_expr, g_bigint_count);
56  const auto chosen_type = get_compact_type(agg_info);
57 
58  if ((chosen_type.is_string() && chosen_type.get_compression() == kENCODING_NONE) ||
59  chosen_type.is_array()) {
60  addSlotForColumn(sizeof(int64_t), col_expr_idx);
61  addSlotForColumn(sizeof(int64_t), col_expr_idx);
62  ++col_expr_idx;
63  continue;
64  }
65  if (chosen_type.is_geometry()) {
66  if (dynamic_cast<const Analyzer::GeoExpr*>(col_expr)) {
67  CHECK_EQ(chosen_type.get_type(), kPOINT);
68  // Pointer/offset into varlen buffer
69  addSlotForColumn(sizeof(int64_t), col_expr_idx);
70  const int64_t arr_size =
71  chosen_type.get_compression() == kENCODING_GEOINT ? 8 : 16;
73  .insert(std::make_pair(slot_sizes_.size() - 1, arr_size))
74  .second);
75  } else {
76  for (auto i = 0; i < chosen_type.get_physical_coord_cols(); ++i) {
77  addSlotForColumn(sizeof(int64_t), col_expr_idx);
78  addSlotForColumn(sizeof(int64_t), col_expr_idx);
79  }
80  }
81  ++col_expr_idx;
82  continue;
83  }
84 
85  const auto col_expr_bitwidth = get_bit_width(chosen_type);
86 
87  CHECK_EQ(size_t(0), col_expr_bitwidth % 8);
88  addSlotForColumn(static_cast<int8_t>(col_expr_bitwidth >> 3), col_expr_idx);
89  // for average, we'll need to keep the count as well
90  if (agg_info.agg_kind == kAVG) {
91  CHECK(agg_info.is_agg);
92  addSlotForColumn(sizeof(int64_t), col_expr_idx);
93  }
94  }
95  ++col_expr_idx;
96  }
97 }
#define CHECK_EQ(x, y)
Definition: Logger.h:301
std::unordered_map< SlotIndex, ArraySize > varlen_output_slot_map_
std::vector< std::vector< size_t > > col_to_slot_map_
std::vector< SlotSize > slot_sizes_
TargetInfo get_target_info(const Analyzer::Expr *target_expr, const bool bigint_count)
Definition: TargetInfo.h:92
const SQLTypeInfo get_compact_type(const TargetInfo &target)
size_t get_bit_width(const SQLTypeInfo &ti)
bool g_bigint_count
void addSlotForColumn(const int8_t logical_size, const size_t column_idx)
#define CHECK(condition)
Definition: Logger.h:291
Definition: sqldefs.h:77

+ Here is the call graph for this function:

Member Function Documentation

void ColSlotContext::addColumn ( const std::vector< std::tuple< int8_t, int8_t >> &  slots_for_col)

Definition at line 259 of file ColSlotContext.cpp.

References addSlotForColumn(), and col_to_slot_map_.

Referenced by QueryMemoryDescriptor::addColSlotInfo().

260  {
261  const auto col_idx = col_to_slot_map_.size();
262  col_to_slot_map_.emplace_back();
263  for (const auto& slot_info : slots_for_col) {
264  addSlotForColumn(std::get<1>(slot_info), std::get<0>(slot_info), col_idx);
265  }
266 }
std::vector< std::vector< size_t > > col_to_slot_map_
void addSlotForColumn(const int8_t logical_size, const size_t column_idx)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ColSlotContext::addColumnFlatBuffer ( const int64_t  flatbuffer_size)

Definition at line 268 of file ColSlotContext.cpp.

References addSlotForColumn(), col_to_slot_map_, and varlen_output_slot_map_.

Referenced by QueryMemoryDescriptor::addColSlotInfoFlatBuffer().

268  {
269  const auto col_idx = col_to_slot_map_.size();
270  col_to_slot_map_.emplace_back();
271  addSlotForColumn(0, 0, col_idx);
272  // reusing varlenOutput infrastructure for storing the size of a flatbuffer:
273  varlen_output_slot_map_.insert(std::make_pair(col_idx, flatbuffer_size));
274 }
std::unordered_map< SlotIndex, ArraySize > varlen_output_slot_map_
std::vector< std::vector< size_t > > col_to_slot_map_
void addSlotForColumn(const int8_t logical_size, const size_t column_idx)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ColSlotContext::addSlotForColumn ( const int8_t  logical_size,
const size_t  column_idx 
)
private

Definition at line 296 of file ColSlotContext.cpp.

Referenced by addColumn(), addColumnFlatBuffer(), and ColSlotContext().

297  {
298  addSlotForColumn(-1, logical_size, column_idx);
299 }
void addSlotForColumn(const int8_t logical_size, const size_t column_idx)

+ Here is the caller graph for this function:

void ColSlotContext::addSlotForColumn ( const int8_t  padded_size,
const int8_t  logical_size,
const size_t  column_idx 
)
private

Definition at line 301 of file ColSlotContext.cpp.

References CHECK_LT, col_to_slot_map_, and slot_sizes_.

303  {
304  CHECK_LT(column_idx, col_to_slot_map_.size());
305  col_to_slot_map_[column_idx].push_back(slot_sizes_.size());
306  slot_sizes_.emplace_back(SlotSize{padded_size, logical_size});
307 }
std::vector< std::vector< size_t > > col_to_slot_map_
std::vector< SlotSize > slot_sizes_
#define CHECK_LT(x, y)
Definition: Logger.h:303
void ColSlotContext::alignPaddedSlots ( const bool  sort_on_gpu)

Definition at line 234 of file ColSlotContext.cpp.

References align_to_int64(), CHECK, CHECK_GE, and slot_sizes_.

Referenced by QueryMemoryDescriptor::alignPaddedSlots().

234  {
235  size_t total_bytes{0};
236  for (size_t slot_idx = 0; slot_idx < slot_sizes_.size(); slot_idx++) {
237  auto chosen_bytes = slot_sizes_[slot_idx].padded_size;
238  if (chosen_bytes == sizeof(int64_t)) {
239  const auto aligned_total_bytes = align_to_int64(total_bytes);
240  CHECK_GE(aligned_total_bytes, total_bytes);
241  if (slot_idx >= 1) {
242  const auto padding = aligned_total_bytes - total_bytes;
243  CHECK(padding == 0 || padding == 4);
244  slot_sizes_[slot_idx - 1].padded_size += padding;
245  }
246  total_bytes = aligned_total_bytes;
247  }
248  total_bytes += chosen_bytes;
249  }
250  if (!sort_on_gpu) {
251  const auto aligned_total_bytes = align_to_int64(total_bytes);
252  CHECK_GE(aligned_total_bytes, total_bytes);
253  const auto padding = aligned_total_bytes - total_bytes;
254  CHECK(padding == 0 || padding == 4);
255  slot_sizes_.back().padded_size += padding;
256  }
257 }
void sort_on_gpu(int64_t *val_buff, int32_t *idx_buff, const uint64_t entry_count, const bool desc, const uint32_t chosen_bytes, ThrustAllocator &alloc, const int device_id)
#define CHECK_GE(x, y)
Definition: Logger.h:306
std::vector< SlotSize > slot_sizes_
#define CHECK(condition)
Definition: Logger.h:291
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:

bool ColSlotContext::checkSlotUsesFlatBufferFormat ( const size_t  slot_idx) const

Definition at line 285 of file ColSlotContext.cpp.

References col_to_slot_map_, slot_sizes_, and varlen_output_slot_map_.

Referenced by QueryMemoryDescriptor::checkSlotUsesFlatBufferFormat().

285  {
286  const auto varlen_map_it = varlen_output_slot_map_.find(slot_idx);
287  if (varlen_map_it != varlen_output_slot_map_.end() &&
288  slot_idx < col_to_slot_map_.size() && col_to_slot_map_[slot_idx].size() == 1) {
289  const auto& slot_size = slot_sizes_[col_to_slot_map_[slot_idx][0]];
290  return slot_size.padded_size == 0 &&
291  slot_size.logical_size == 0; // as per addColumnFlatBuffer
292  }
293  return false;
294 }
std::unordered_map< SlotIndex, ArraySize > varlen_output_slot_map_
std::vector< std::vector< size_t > > col_to_slot_map_
std::vector< SlotSize > slot_sizes_

+ Here is the caller graph for this function:

void ColSlotContext::clear ( )

Definition at line 229 of file ColSlotContext.cpp.

References col_to_slot_map_, and slot_sizes_.

Referenced by QueryMemoryDescriptor::clearSlotInfo().

229  {
230  slot_sizes_.clear();
231  col_to_slot_map_.clear();
232 }
std::vector< std::vector< size_t > > col_to_slot_map_
std::vector< SlotSize > slot_sizes_

+ Here is the caller graph for this function:

bool ColSlotContext::empty ( )

Definition at line 225 of file ColSlotContext.cpp.

References slot_sizes_.

225  {
226  return slot_sizes_.empty();
227 }
std::vector< SlotSize > slot_sizes_
size_t ColSlotContext::getAlignedPaddedSizeForRange ( const size_t  end) const

Definition at line 152 of file ColSlotContext.cpp.

References gpu_enabled::accumulate(), align_to_int64(), CHECK_GE, and slot_sizes_.

Referenced by getAllSlotsAlignedPaddedSize(), and getColOnlyOffInBytes().

152  {
153  return std::accumulate(slot_sizes_.cbegin(),
154  slot_sizes_.cbegin() + end,
155  size_t(0),
156  [](size_t sum, const auto& slot_size) {
157  CHECK_GE(slot_size.padded_size, 0);
158  const auto chosen_bytes =
159  static_cast<size_t>(slot_size.padded_size);
160  if (chosen_bytes == sizeof(int64_t)) {
161  return align_to_int64(sum) + chosen_bytes;
162  } else {
163  return sum + chosen_bytes;
164  }
165  });
166 }
#define CHECK_GE(x, y)
Definition: Logger.h:306
std::vector< SlotSize > slot_sizes_
DEVICE auto accumulate(ARGS &&...args)
Definition: gpu_enabled.h:42
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:

size_t ColSlotContext::getAllSlotsAlignedPaddedSize ( ) const

Definition at line 148 of file ColSlotContext.cpp.

References getAlignedPaddedSizeForRange(), and slot_sizes_.

Referenced by QueryMemoryDescriptor::getColsSize().

148  {
150 }
std::vector< SlotSize > slot_sizes_
size_t getAlignedPaddedSizeForRange(const size_t end) const

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

size_t ColSlotContext::getAllSlotsPaddedSize ( ) const

Definition at line 138 of file ColSlotContext.cpp.

References gpu_enabled::accumulate(), CHECK_GE, and slot_sizes_.

Referenced by QueryMemoryDescriptor::getRowWidth().

138  {
139  return std::accumulate(slot_sizes_.cbegin(),
140  slot_sizes_.cend(),
141  size_t(0),
142  [](size_t sum, const auto& slot_size) {
143  CHECK_GE(slot_size.padded_size, 0);
144  return sum + static_cast<size_t>(slot_size.padded_size);
145  });
146 }
#define CHECK_GE(x, y)
Definition: Logger.h:306
std::vector< SlotSize > slot_sizes_
DEVICE auto accumulate(ARGS &&...args)
Definition: gpu_enabled.h:42

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

size_t ColSlotContext::getColCount ( ) const

Definition at line 131 of file ColSlotContext.cpp.

References col_to_slot_map_.

Referenced by QueryMemoryDescriptor::getColCount().

131  {
132  return col_to_slot_map_.size();
133 }
std::vector< std::vector< size_t > > col_to_slot_map_

+ Here is the caller graph for this function:

size_t ColSlotContext::getColOnlyOffInBytes ( const size_t  slot_idx) const

Definition at line 216 of file ColSlotContext.cpp.

References align_to_int64(), CHECK_LT, getAlignedPaddedSizeForRange(), and slot_sizes_.

Referenced by QueryMemoryDescriptor::getColOnlyOffInBytes().

216  {
217  CHECK_LT(slot_idx, slot_sizes_.size());
218  auto offset_bytes = getAlignedPaddedSizeForRange(slot_idx);
219  if (slot_sizes_[slot_idx].padded_size == sizeof(int64_t)) {
220  offset_bytes = align_to_int64(offset_bytes);
221  }
222  return offset_bytes;
223 }
std::vector< SlotSize > slot_sizes_
size_t getAlignedPaddedSizeForRange(const size_t end) const
#define CHECK_LT(x, y)
Definition: Logger.h:303
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:

size_t ColSlotContext::getCompactByteWidth ( ) const

Definition at line 192 of file ColSlotContext.cpp.

References CHECK_EQ, CHECK_GT, and slot_sizes_.

Referenced by QueryMemoryDescriptor::getCompactByteWidth().

192  {
193  if (slot_sizes_.empty()) {
194  return 8;
195  }
196  size_t compact_width{0};
197  for (const auto& slot_size : slot_sizes_) {
198  if (slot_size.padded_size != 0) {
199  compact_width = slot_size.padded_size;
200  break;
201  }
202  }
203  if (!compact_width) {
204  return 0;
205  }
206  CHECK_GT(compact_width, size_t(0));
207  for (const auto& slot_size : slot_sizes_) {
208  if (slot_size.padded_size == 0) {
209  continue;
210  }
211  CHECK_EQ(static_cast<size_t>(slot_size.padded_size), compact_width);
212  }
213  return compact_width;
214 }
#define CHECK_EQ(x, y)
Definition: Logger.h:301
std::vector< SlotSize > slot_sizes_
#define CHECK_GT(x, y)
Definition: Logger.h:305

+ Here is the caller graph for this function:

int64_t ColSlotContext::getFlatBufferSize ( const size_t  slot_idx) const

Definition at line 276 of file ColSlotContext.cpp.

References to_string(), and varlen_output_slot_map_.

Referenced by QueryMemoryDescriptor::getFlatBufferSize().

276  {
277  const auto varlen_map_it = varlen_output_slot_map_.find(slot_idx);
278  if (varlen_map_it == varlen_output_slot_map_.end()) {
279  throw std::runtime_error("Failed to find FlatBuffer map entry for slot " +
280  std::to_string(slot_idx));
281  }
282  return varlen_map_it->second;
283 }
std::unordered_map< SlotIndex, ArraySize > varlen_output_slot_map_
std::string to_string(char const *&&v)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int8_t ColSlotContext::getMinPaddedByteSize ( const int8_t  actual_min_byte_width) const

Definition at line 181 of file ColSlotContext.cpp.

References slot_sizes_.

Referenced by QueryMemoryDescriptor::updateActualMinByteWidth().

181  {
182  if (slot_sizes_.empty()) {
183  return actual_min_byte_width;
184  }
185  const auto min_padded_size = std::min_element(
186  slot_sizes_.cbegin(), slot_sizes_.cend(), [](const auto& lhs, const auto& rhs) {
187  return lhs.padded_size < rhs.padded_size;
188  });
189  return std::min(min_padded_size->padded_size, actual_min_byte_width);
190 }
std::vector< SlotSize > slot_sizes_

+ Here is the caller graph for this function:

size_t ColSlotContext::getSlotCount ( ) const

Definition at line 134 of file ColSlotContext.cpp.

References slot_sizes_.

Referenced by QueryMemoryDescriptor::getBufferColSlotCount(), QueryMemoryDescriptor::getSlotCount(), QueryMemoryDescriptor::varlenOutputBufferElemSize(), and QueryMemoryDescriptor::varlenOutputRowSizeToSlot().

134  {
135  return slot_sizes_.size();
136 }
std::vector< SlotSize > slot_sizes_

+ Here is the caller graph for this function:

const SlotSize& ColSlotContext::getSlotInfo ( const size_t  slot_idx) const
inline

Definition at line 66 of file ColSlotContext.h.

References CHECK_LT, and slot_sizes_.

Referenced by QueryMemoryInitializer::copyFromTableFunctionGpuBuffers(), QueryMemoryDescriptor::getLogicalSlotWidthBytes(), QueryMemoryDescriptor::getPaddedSlotWidthBytes(), and QueryMemoryInitializer::setupTableFunctionGpuBuffers().

66  {
67  CHECK_LT(slot_idx, slot_sizes_.size());
68  return slot_sizes_[slot_idx];
69  }
std::vector< SlotSize > slot_sizes_
#define CHECK_LT(x, y)
Definition: Logger.h:303

+ Here is the caller graph for this function:

const std::vector<size_t>& ColSlotContext::getSlotsForCol ( const size_t  col_idx) const
inline

Definition at line 76 of file ColSlotContext.h.

References CHECK_LT, and col_to_slot_map_.

Referenced by QueryMemoryDescriptor::getSlotIndexForSingleSlotCol().

76  {
77  CHECK_LT(col_idx, col_to_slot_map_.size());
78  return col_to_slot_map_[col_idx];
79  }
std::vector< std::vector< size_t > > col_to_slot_map_
#define CHECK_LT(x, y)
Definition: Logger.h:303

+ Here is the caller graph for this function:

size_t ColSlotContext::getTotalBytesOfColumnarBuffers ( const size_t  entry_count) const

Definition at line 168 of file ColSlotContext.cpp.

References gpu_enabled::accumulate(), align_to_int64(), CHECK_GE, and slot_sizes_.

Referenced by QueryMemoryDescriptor::getTotalBytesOfColumnarBuffers().

168  {
169  const auto total_bytes = std::accumulate(
170  slot_sizes_.cbegin(),
171  slot_sizes_.cend(),
172  size_t(0),
173  [entry_count](size_t sum, const auto& slot_size) {
174  CHECK_GE(slot_size.padded_size, 0);
175  return sum +
176  align_to_int64(static_cast<size_t>(slot_size.padded_size) * entry_count);
177  });
178  return align_to_int64(total_bytes);
179 }
#define CHECK_GE(x, y)
Definition: Logger.h:306
std::vector< SlotSize > slot_sizes_
DEVICE auto accumulate(ARGS &&...args)
Definition: gpu_enabled.h:42
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:

bool ColSlotContext::hasVarlenOutput ( ) const
inline

Definition at line 120 of file ColSlotContext.h.

References varlen_output_slot_map_.

Referenced by QueryMemoryDescriptor::hasVarlenOutput().

120  {
121  return !varlen_output_slot_map_.empty();
122  }
std::unordered_map< SlotIndex, ArraySize > varlen_output_slot_map_

+ Here is the caller graph for this function:

bool ColSlotContext::operator!= ( const ColSlotContext that) const
inline

Definition at line 112 of file ColSlotContext.h.

112  {
113  return !(*this == that);
114  }
bool ColSlotContext::operator== ( const ColSlotContext that) const
inline

Definition at line 104 of file ColSlotContext.h.

References col_to_slot_map_, and slot_sizes_.

104  {
105  return std::equal(
106  slot_sizes_.cbegin(), slot_sizes_.cend(), that.slot_sizes_.cbegin()) &&
107  std::equal(col_to_slot_map_.cbegin(),
108  col_to_slot_map_.cend(),
109  that.col_to_slot_map_.cbegin());
110  }
std::vector< std::vector< size_t > > col_to_slot_map_
std::vector< SlotSize > slot_sizes_
void ColSlotContext::setAllSlotsPaddedSize ( const int8_t  padded_size)

Definition at line 104 of file ColSlotContext.cpp.

References slot_sizes_.

104  {
105  for (auto& slot_size : slot_sizes_) {
106  slot_size.padded_size = padded_size;
107  }
108 }
std::vector< SlotSize > slot_sizes_
void ColSlotContext::setAllSlotsPaddedSizeToLogicalSize ( )

Definition at line 118 of file ColSlotContext.cpp.

References slot_sizes_.

Referenced by QueryMemoryDescriptor::QueryMemoryDescriptor(), and QueryMemoryDescriptor::setOutputColumnar().

118  {
119  for (auto& slot_size : slot_sizes_) {
120  slot_size.padded_size = slot_size.logical_size;
121  }
122 }
std::vector< SlotSize > slot_sizes_

+ Here is the caller graph for this function:

void ColSlotContext::setAllSlotsSize ( const int8_t  slot_width_size)

Definition at line 99 of file ColSlotContext.cpp.

References gpu_enabled::fill(), and slot_sizes_.

Referenced by QueryMemoryDescriptor::useConsistentSlotWidthSize().

99  {
100  const SlotSize ss{slot_width_size, slot_width_size};
101  std::fill(slot_sizes_.begin(), slot_sizes_.end(), ss);
102 }
std::vector< SlotSize > slot_sizes_
DEVICE void fill(ARGS &&...args)
Definition: gpu_enabled.h:60

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ColSlotContext::setAllUnsetSlotsPaddedSize ( const int8_t  padded_size)

Definition at line 110 of file ColSlotContext.cpp.

References slot_sizes_.

Referenced by QueryMemoryDescriptor::QueryMemoryDescriptor().

110  {
111  for (auto& slot_size : slot_sizes_) {
112  if (slot_size.padded_size < 0) {
113  slot_size.padded_size = padded_size;
114  }
115  }
116 }
std::vector< SlotSize > slot_sizes_

+ Here is the caller graph for this function:

void ColSlotContext::setPaddedSlotWidthBytes ( const size_t  slot_idx,
const int8_t  bytes 
)
inline

Definition at line 71 of file ColSlotContext.h.

References CHECK_LT, and slot_sizes_.

Referenced by QueryMemoryDescriptor::setPaddedSlotWidthBytes().

71  {
72  CHECK_LT(slot_idx, slot_sizes_.size());
73  slot_sizes_[slot_idx].padded_size = bytes;
74  }
std::vector< SlotSize > slot_sizes_
#define CHECK_LT(x, y)
Definition: Logger.h:303

+ Here is the caller graph for this function:

bool ColSlotContext::slotIsVarlen ( const size_t  slot_idx) const
inline

Definition at line 124 of file ColSlotContext.h.

References varlen_output_slot_map_.

Referenced by QueryMemoryDescriptor::slotIsVarlenOutput().

124  {
125  return varlen_output_slot_map_.count(slot_idx) > 0;
126  }
std::unordered_map< SlotIndex, ArraySize > varlen_output_slot_map_

+ Here is the caller graph for this function:

std::string ColSlotContext::toString ( ) const
inline

Definition at line 130 of file ColSlotContext.h.

References col_to_slot_map_, slot_sizes_, to_string(), and varlen_output_slot_map_.

Referenced by QueryMemoryDescriptor::reductionKey().

130  {
131  std::string str{"Col Slot Context State\n"};
132  if (slot_sizes_.empty()) {
133  str += "\tEmpty";
134  return str;
135  }
136  str += "\tN | P , L\n";
137  for (size_t i = 0; i < slot_sizes_.size(); i++) {
138  const auto& slot_size = slot_sizes_[i];
139  str += "\t" + std::to_string(i) + " | " + std::to_string(slot_size.padded_size) +
140  " , " + std::to_string(slot_size.logical_size) + "\n";
141  }
142 #ifdef HAVE_TOSTRING
143  str += "\tcol_to_slot_map=" + ::toString(col_to_slot_map_) + "\n";
144  str += "\tvarlen_output_slot_map=" + ::toString(varlen_output_slot_map_) + "\n";
145 #endif
146  return str;
147  }
std::unordered_map< SlotIndex, ArraySize > varlen_output_slot_map_
std::vector< std::vector< size_t > > col_to_slot_map_
std::vector< SlotSize > slot_sizes_
std::string to_string(char const *&&v)
std::string toString() const

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ColSlotContext::validate ( ) const

Definition at line 124 of file ColSlotContext.cpp.

References CHECK_GE, CHECK_LE, and slot_sizes_.

Referenced by QueryMemoryDescriptor::QueryMemoryDescriptor().

124  {
125  for (const auto& slot_size : slot_sizes_) {
126  CHECK_GE(slot_size.logical_size, 0);
127  CHECK_LE(slot_size.logical_size, slot_size.padded_size);
128  }
129 }
#define CHECK_GE(x, y)
Definition: Logger.h:306
std::vector< SlotSize > slot_sizes_
#define CHECK_LE(x, y)
Definition: Logger.h:304

+ Here is the caller graph for this function:

int64_t ColSlotContext::varlenOutputElementSize ( const size_t  slot_idx) const

Definition at line 309 of file ColSlotContext.cpp.

References to_string(), and varlen_output_slot_map_.

Referenced by QueryMemoryDescriptor::varlenOutputBufferElemSize(), and QueryMemoryDescriptor::varlenOutputRowSizeToSlot().

309  {
310  const auto varlen_map_it = varlen_output_slot_map_.find(slot_idx);
311  if (varlen_map_it == varlen_output_slot_map_.end()) {
312  throw std::runtime_error("Failed to find varlen map entry for slot " +
313  std::to_string(slot_idx));
314  }
315  return varlen_map_it->second;
316 }
std::unordered_map< SlotIndex, ArraySize > varlen_output_slot_map_
std::string to_string(char const *&&v)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Member Data Documentation

std::vector<std::vector<size_t> > ColSlotContext::col_to_slot_map_
private
std::unordered_map<SlotIndex, ArraySize> ColSlotContext::varlen_output_slot_map_
private

The documentation for this class was generated from the following files: