OmniSciDB  06b3bd477c
 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)
 
bool is_simple_count (const TargetInfo &target_info)
 
bool target_has_geo (const TargetInfo &target_info)
 
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(), TargetExprCodegen::codegenAggregate(), 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:241
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 556 of file TargetExprBuilder.cpp.

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

Referenced by TargetExprCodegenBuilder::codegenMultiSlotSampleExpressions().

557  {
558  const bool is_group_by{query_mem_desc.isGroupBy()};
559  if (target_info.agg_kind == kSAMPLE && target_info.sql_type.is_string() &&
560  target_info.sql_type.get_compression() != kENCODING_NONE) {
561  return get_agg_initial_val(target_info.agg_kind,
562  target_info.sql_type,
563  is_group_by,
564  query_mem_desc.getCompactByteWidth());
565  }
566  return 0;
567 }
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
HOST DEVICE EncodingType get_compression() const
Definition: sqltypes.h:266
bool is_string() const
Definition: sqltypes.h:415

+ 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:

bool anonymous_namespace{TargetExprBuilder.cpp}::is_simple_count ( const TargetInfo target_info)

Definition at line 81 of file TargetExprBuilder.cpp.

References TargetInfo::agg_kind, TargetInfo::is_agg, TargetInfo::is_distinct, and kCOUNT.

Referenced by TargetExprCodegen::codegen(), and TargetExprCodegen::codegenAggregate().

81  {
82  return target_info.is_agg && target_info.agg_kind == kCOUNT && !target_info.is_distinct;
83 }
bool is_agg
Definition: TargetInfo.h:40
SQLAgg agg_kind
Definition: TargetInfo.h:41
Definition: sqldefs.h:76
bool is_distinct
Definition: TargetInfo.h:45

+ Here is the caller graph for this function:

bool anonymous_namespace{TargetExprBuilder.cpp}::target_has_geo ( const TargetInfo target_info)

Definition at line 85 of file TargetExprBuilder.cpp.

References TargetInfo::agg_arg_type, TargetInfo::is_agg, SQLTypeInfo::is_geometry(), and TargetInfo::sql_type.

Referenced by TargetExprCodegen::codegen(), and TargetExprCodegen::codegenAggregate().

85  {
86  return target_info.is_agg ? target_info.agg_arg_type.is_geometry()
87  : target_info.sql_type.is_geometry();
88 }
SQLTypeInfo sql_type
Definition: TargetInfo.h:42
SQLTypeInfo agg_arg_type
Definition: TargetInfo.h:43
bool is_agg
Definition: TargetInfo.h:40
bool is_geometry() const
Definition: sqltypes.h:427

+ Here is the call graph for this function:

+ Here is the caller graph for this function: