OmniSciDB  addbbd5075
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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

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, kSINGLE_VALUE, 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 kSINGLE_VALUE:
67  return {"checked_single_agg_id"};
68  case kSAMPLE:
69  return {"agg_id"};
70  default:
71  UNREACHABLE() << "Unrecognized agg kind: " << std::to_string(target_info.agg_kind);
72  }
73  return {};
74 }
#define UNREACHABLE()
Definition: Logger.h:237
std::string to_string(char const *&&v)
Definition: sqldefs.h:73
const SQLTypeInfo get_compact_type(const TargetInfo &target)
bool is_agg
Definition: TargetInfo.h:40
Definition: sqldefs.h:75
SQLAgg agg_kind
Definition: TargetInfo.h:41
Definition: sqldefs.h:76
bool is_distinct
Definition: TargetInfo.h:45
Definition: sqldefs.h:74
Definition: sqldefs.h:72

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Definition at line 505 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().

506  {
507  const bool is_group_by{query_mem_desc.isGroupBy()};
508  if (target_info.agg_kind == kSAMPLE && target_info.sql_type.is_string() &&
509  target_info.sql_type.get_compression() != kENCODING_NONE) {
510  return get_agg_initial_val(target_info.agg_kind,
511  target_info.sql_type,
512  is_group_by,
513  query_mem_desc.getCompactByteWidth());
514  }
515  return 0;
516 }
HOST DEVICE EncodingType get_compression() const
Definition: sqltypes.h:334
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)
SQLAgg agg_kind
Definition: TargetInfo.h:41
bool is_string() const
Definition: sqltypes.h:477

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Definition at line 76 of file TargetExprBuilder.cpp.

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

Referenced by TargetExprCodegenBuilder::operator()().

76  {
77  return query_mem_desc.getQueryDescriptionType() == QueryDescriptionType::Projection &&
78  query_mem_desc.didOutputColumnar();
79 }
QueryDescriptionType getQueryDescriptionType() const

+ Here is the call graph for this function:

+ Here is the caller graph for this function: