OmniSciDB  343343d194
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
anonymous_namespace{OutputBufferInitialization.cpp} Namespace Reference

Functions

std::vector< int64_t > init_agg_val_vec (const std::vector< TargetInfo > &targets, const QueryMemoryDescriptor &query_mem_desc)
 

Function Documentation

std::vector<int64_t> anonymous_namespace{OutputBufferInitialization.cpp}::init_agg_val_vec ( const std::vector< TargetInfo > &  targets,
const QueryMemoryDescriptor query_mem_desc 
)
inline

Definition at line 27 of file OutputBufferInitialization.cpp.

References CHECK_GT, CHECK_LT, get_agg_initial_val(), get_compact_type(), QueryMemoryDescriptor::getCompactByteWidth(), QueryMemoryDescriptor::getPaddedSlotWidthBytes(), QueryMemoryDescriptor::getSlotCount(), QueryMemoryDescriptor::isGroupBy(), QueryMemoryDescriptor::isLogicalSizedColumnsAllowed(), kAVG, kENCODING_NONE, kSAMPLE, and takes_float_argument().

Referenced by init_agg_val_vec().

29  {
30  std::vector<int64_t> agg_init_vals;
31  agg_init_vals.reserve(query_mem_desc.getSlotCount());
32  const bool is_group_by{query_mem_desc.isGroupBy()};
33  for (size_t target_idx = 0, agg_col_idx = 0; target_idx < targets.size();
34  ++target_idx, ++agg_col_idx) {
35  CHECK_LT(agg_col_idx, query_mem_desc.getSlotCount());
36  const auto agg_info = targets[target_idx];
37  if (!agg_info.is_agg || agg_info.agg_kind == kSAMPLE) {
38  if (agg_info.agg_kind == kSAMPLE && agg_info.sql_type.is_string() &&
39  agg_info.sql_type.get_compression() != kENCODING_NONE) {
40  agg_init_vals.push_back(
41  get_agg_initial_val(agg_info.agg_kind,
42  agg_info.sql_type,
43  is_group_by,
44  query_mem_desc.getCompactByteWidth()));
45  continue;
46  }
47  if (query_mem_desc.getPaddedSlotWidthBytes(agg_col_idx) > 0) {
48  agg_init_vals.push_back(0);
49  }
50  if (agg_info.sql_type.is_array() ||
51  (agg_info.sql_type.is_string() &&
52  agg_info.sql_type.get_compression() == kENCODING_NONE)) {
53  agg_init_vals.push_back(0);
54  }
55  if (agg_info.sql_type.is_geometry()) {
56  agg_init_vals.push_back(0);
57  for (auto i = 1; i < agg_info.sql_type.get_physical_coord_cols(); ++i) {
58  agg_init_vals.push_back(0);
59  agg_init_vals.push_back(0);
60  }
61  }
62  continue;
63  }
64  CHECK_GT(query_mem_desc.getPaddedSlotWidthBytes(agg_col_idx), 0);
65  const bool float_argument_input = takes_float_argument(agg_info);
66  const auto chosen_bytes = query_mem_desc.isLogicalSizedColumnsAllowed()
67  ? query_mem_desc.getPaddedSlotWidthBytes(agg_col_idx)
68  : query_mem_desc.getCompactByteWidth();
69  auto init_ti = get_compact_type(agg_info);
70  if (!is_group_by) {
71  init_ti.set_notnull(false);
72  }
73  agg_init_vals.push_back(
74  get_agg_initial_val(agg_info.agg_kind,
75  init_ti,
76  is_group_by || float_argument_input,
77  (float_argument_input ? sizeof(float) : chosen_bytes)));
78  if (kAVG == agg_info.agg_kind) {
79  ++agg_col_idx;
80  agg_init_vals.push_back(0);
81  }
82  }
83  return agg_init_vals;
84 }
bool isLogicalSizedColumnsAllowed() const
int64_t get_agg_initial_val(const SQLAgg agg, const SQLTypeInfo &ti, const bool enable_compaction, const unsigned min_byte_width_to_compact)
bool takes_float_argument(const TargetInfo &target_info)
Definition: TargetInfo.h:120
#define CHECK_GT(x, y)
Definition: Logger.h:199
const SQLTypeInfo get_compact_type(const TargetInfo &target)
const int8_t getPaddedSlotWidthBytes(const size_t slot_idx) const
#define CHECK_LT(x, y)
Definition: Logger.h:197
Definition: sqldefs.h:71

+ Here is the call graph for this function:

+ Here is the caller graph for this function: