OmniSciDB  a5dc49c757
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
anonymous_namespace{TargetExprBuilder.cpp} Namespace Reference

Functions

bool is_varlen_projection (const Analyzer::Expr *target_expr, const SQLTypeInfo &ti)
 
std::vector< std::string > agg_fn_base_names (const TargetInfo &target_info, const bool is_varlen_projection)
 
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,
const bool  is_varlen_projection 
)

Definition at line 46 of file TargetExprBuilder.cpp.

References TargetInfo::agg_kind, CHECK, get_compact_type(), TargetInfo::is_agg, TargetInfo::is_distinct, kAPPROX_COUNT_DISTINCT, kAPPROX_QUANTILE, kAVG, kCOUNT, kCOUNT_IF, kMAX, kMIN, kMODE, kSAMPLE, kSINGLE_VALUE, kSUM, kSUM_IF, and UNREACHABLE.

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

47  {
48  const auto& chosen_type = get_compact_type(target_info);
50  // TODO: support other types here
51  CHECK(chosen_type.is_geometry());
52  return {"agg_id_varlen"};
53  }
54  if (!target_info.is_agg || target_info.agg_kind == kSAMPLE) {
55  if (chosen_type.is_geometry()) {
56  return std::vector<std::string>(2 * chosen_type.get_physical_coord_cols(),
57  "agg_id");
58  }
59  if (chosen_type.is_varlen()) {
60  // not a varlen projection (not creating new varlen outputs). Just store the pointer
61  // and offset into the input buffer in the output slots.
62  return {"agg_id", "agg_id"};
63  }
64  return {"agg_id"};
65  }
66  switch (target_info.agg_kind) {
67  case kAVG:
68  return {"agg_sum", "agg_count"};
69  case kCOUNT:
70  return {target_info.is_distinct ? "agg_count_distinct" : "agg_count"};
71  case kCOUNT_IF:
72  return {"agg_count_if"};
73  case kMAX:
74  return {"agg_max"};
75  case kMIN:
76  return {"agg_min"};
77  case kSUM:
78  return {"agg_sum"};
79  case kSUM_IF:
80  return {"agg_sum_if"};
82  return {"agg_approximate_count_distinct"};
83  case kAPPROX_QUANTILE:
84  return {"agg_approx_quantile"};
85  case kSINGLE_VALUE:
86  return {"checked_single_agg_id"};
87  case kSAMPLE:
88  return {"agg_id"};
89  case kMODE:
90  return {"agg_mode_func"};
91  default:
92  UNREACHABLE() << "Unrecognized agg kind: " << target_info.agg_kind;
93  }
94  return {};
95 }
#define UNREACHABLE()
Definition: Logger.h:338
Definition: sqldefs.h:78
const SQLTypeInfo get_compact_type(const TargetInfo &target)
bool is_varlen_projection(const Analyzer::Expr *target_expr, const SQLTypeInfo &ti)
bool is_agg
Definition: TargetInfo.h:50
Definition: sqldefs.h:80
SQLAgg agg_kind
Definition: TargetInfo.h:51
Definition: sqldefs.h:81
#define CHECK(condition)
Definition: Logger.h:291
bool is_distinct
Definition: TargetInfo.h:55
Definition: sqldefs.h:79
Definition: sqldefs.h:77
Definition: sqldefs.h:86

+ 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 729 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().

730  {
731  const bool is_group_by{query_mem_desc.isGroupBy()};
732  if (target_info.agg_kind == kSAMPLE && target_info.sql_type.is_string() &&
733  target_info.sql_type.get_compression() != kENCODING_NONE) {
734  return get_agg_initial_val(target_info.agg_kind,
735  target_info.sql_type,
736  is_group_by,
737  query_mem_desc.getCompactByteWidth());
738  }
739  return 0;
740 }
SQLTypeInfo sql_type
Definition: TargetInfo.h:52
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:51
HOST DEVICE EncodingType get_compression() const
Definition: sqltypes.h:399
bool is_string() const
Definition: sqltypes.h:561

+ 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 97 of file TargetExprBuilder.cpp.

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

Referenced by TargetExprCodegenBuilder::operator()().

97  {
98  return (query_mem_desc.getQueryDescriptionType() == QueryDescriptionType::Projection ||
99  query_mem_desc.getQueryDescriptionType() ==
101  query_mem_desc.didOutputColumnar();
102 }
Projection
Definition: enums.h:58
TableFunction
Definition: enums.h:58
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 104 of file TargetExprBuilder.cpp.

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

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

104  {
105  return target_info.is_agg && shared::is_any<kCOUNT>(target_info.agg_kind) &&
106  !target_info.is_distinct;
107 }
bool is_agg
Definition: TargetInfo.h:50
SQLAgg agg_kind
Definition: TargetInfo.h:51
bool is_distinct
Definition: TargetInfo.h:55

+ Here is the caller graph for this function:

bool anonymous_namespace{TargetExprBuilder.cpp}::is_varlen_projection ( const Analyzer::Expr target_expr,
const SQLTypeInfo ti 
)
inline

Definition at line 41 of file TargetExprBuilder.cpp.

References SQLTypeInfo::get_type(), and kPOINT.

Referenced by TargetExprCodegen::codegen(), TargetExprCodegen::codegenAggregate(), anonymous_namespace{QueryMemoryDescriptor.cpp}::get_col_byte_widths(), target_info::get_target_info_impl(), and TargetExprCodegenBuilder::operator()().

42  {
43  return dynamic_cast<const Analyzer::GeoExpr*>(target_expr) && ti.get_type() == kPOINT;
44 }
HOST DEVICE SQLTypes get_type() const
Definition: sqltypes.h:391

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

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

109  {
110  return target_info.is_agg ? target_info.agg_arg_type.is_geometry()
111  : target_info.sql_type.is_geometry();
112 }
SQLTypeInfo sql_type
Definition: TargetInfo.h:52
SQLTypeInfo agg_arg_type
Definition: TargetInfo.h:53
bool is_agg
Definition: TargetInfo.h:50
bool is_geometry() const
Definition: sqltypes.h:597

+ Here is the call graph for this function:

+ Here is the caller graph for this function: