OmniSciDB  5ade3759e0
anonymous_namespace{TargetExprBuilder.cpp} Namespace Reference

Functions

std::vector< std::string > agg_fn_base_names (const TargetInfo &target_info)
 
bool is_columnar_projection (const QueryMemoryDescriptor &query_mem_desc)
 
int64_t get_initial_agg_val (const TargetInfo &target_info, const QueryMemoryDescriptor &query_mem_desc)
 

Function Documentation

◆ agg_fn_base_names()

std::vector<std::string> anonymous_namespace{TargetExprBuilder.cpp}::agg_fn_base_names ( const TargetInfo target_info)

Definition at line 41 of file TargetExprBuilder.cpp.

References TargetInfo::agg_kind, get_compact_type(), TargetInfo::is_agg, TargetInfo::is_distinct, kAPPROX_COUNT_DISTINCT, kAVG, kCOUNT, kMAX, kMIN, kSAMPLE, kSUM, to_string(), and UNREACHABLE.

Referenced by TargetExprCodegen::codegen(), and TargetExprCodegenBuilder::operator()().

41  {
42  const auto& chosen_type = get_compact_type(target_info);
43  if (!target_info.is_agg || target_info.agg_kind == kSAMPLE) {
44  if (chosen_type.is_geometry()) {
45  return std::vector<std::string>(2 * chosen_type.get_physical_coord_cols(),
46  "agg_id");
47  }
48  if (chosen_type.is_varlen()) {
49  return {"agg_id", "agg_id"};
50  }
51  return {"agg_id"};
52  }
53  switch (target_info.agg_kind) {
54  case kAVG:
55  return {"agg_sum", "agg_count"};
56  case kCOUNT:
57  return {target_info.is_distinct ? "agg_count_distinct" : "agg_count"};
58  case kMAX:
59  return {"agg_max"};
60  case kMIN:
61  return {"agg_min"};
62  case kSUM:
63  return {"agg_sum"};
65  return {"agg_approximate_count_distinct"};
66  case kSAMPLE:
67  return {"agg_id"};
68  default:
69  UNREACHABLE() << "Unrecognized agg kind: " << std::to_string(target_info.agg_kind);
70  }
71  return {};
72 }
#define UNREACHABLE()
Definition: Logger.h:231
std::string to_string(char const *&&v)
Definition: sqldefs.h:71
const SQLTypeInfo get_compact_type(const TargetInfo &target)
bool is_agg
Definition: TargetInfo.h:40
Definition: sqldefs.h:71
SQLAgg agg_kind
Definition: TargetInfo.h:41
Definition: sqldefs.h:71
bool is_distinct
Definition: TargetInfo.h:45
Definition: sqldefs.h:71
Definition: sqldefs.h:71
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get_initial_agg_val()

int64_t anonymous_namespace{TargetExprBuilder.cpp}::get_initial_agg_val ( const TargetInfo target_info,
const QueryMemoryDescriptor query_mem_desc 
)
inline

Definition at line 495 of file TargetExprBuilder.cpp.

References TargetInfo::agg_kind, get_agg_initial_val(), SQLTypeInfoCore< TYPE_FACET_PACK >::get_compression(), QueryMemoryDescriptor::getCompactByteWidth(), TargetExprCodegen::is_group_by, SQLTypeInfoCore< TYPE_FACET_PACK >::is_string(), QueryMemoryDescriptor::isGroupBy(), kENCODING_NONE, kSAMPLE, and TargetInfo::sql_type.

Referenced by TargetExprCodegenBuilder::codegenMultiSlotSampleExpressions().

496  {
497  const bool is_group_by{query_mem_desc.isGroupBy()};
498  if (target_info.agg_kind == kSAMPLE && target_info.sql_type.is_string() &&
499  target_info.sql_type.get_compression() != kENCODING_NONE) {
500  return get_agg_initial_val(target_info.agg_kind,
501  target_info.sql_type,
502  is_group_by,
503  query_mem_desc.getCompactByteWidth());
504  }
505  return 0;
506 }
SQLTypeInfo sql_type
Definition: TargetInfo.h:42
int64_t get_agg_initial_val(const SQLAgg agg, const SQLTypeInfo &ti, const bool enable_compaction, const unsigned min_byte_width_to_compact)
HOST DEVICE EncodingType get_compression() const
Definition: sqltypes.h:331
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:

◆ is_columnar_projection()

bool anonymous_namespace{TargetExprBuilder.cpp}::is_columnar_projection ( const QueryMemoryDescriptor query_mem_desc)
inline

Definition at line 74 of file TargetExprBuilder.cpp.

References QueryMemoryDescriptor::didOutputColumnar(), QueryMemoryDescriptor::getQueryDescriptionType(), and Projection.

Referenced by TargetExprCodegenBuilder::operator()().

74  {
75  return query_mem_desc.getQueryDescriptionType() == QueryDescriptionType::Projection &&
76  query_mem_desc.didOutputColumnar();
77 }
QueryDescriptionType getQueryDescriptionType() const
+ Here is the call graph for this function:
+ Here is the caller graph for this function: