OmniSciDB  085a039ca4
 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, kMAX, kMIN, kSAMPLE, kSINGLE_VALUE, kSUM, to_string(), 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 kMAX:
72  return {"agg_max"};
73  case kMIN:
74  return {"agg_min"};
75  case kSUM:
76  return {"agg_sum"};
78  return {"agg_approximate_count_distinct"};
79  case kAPPROX_QUANTILE:
80  return {"agg_approx_quantile"};
81  case kSINGLE_VALUE:
82  return {"checked_single_agg_id"};
83  case kSAMPLE:
84  return {"agg_id"};
85  default:
86  UNREACHABLE() << "Unrecognized agg kind: " << std::to_string(target_info.agg_kind);
87  }
88  return {};
89 }
#define UNREACHABLE()
Definition: Logger.h:267
std::string to_string(char const *&&v)
Definition: sqldefs.h:75
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:49
Definition: sqldefs.h:77
SQLAgg agg_kind
Definition: TargetInfo.h:50
Definition: sqldefs.h:78
#define CHECK(condition)
Definition: Logger.h:223
bool is_distinct
Definition: TargetInfo.h:54
Definition: sqldefs.h:76
Definition: sqldefs.h:74

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

702  {
703  const bool is_group_by{query_mem_desc.isGroupBy()};
704  if (target_info.agg_kind == kSAMPLE && target_info.sql_type.is_string() &&
705  target_info.sql_type.get_compression() != kENCODING_NONE) {
706  return get_agg_initial_val(target_info.agg_kind,
707  target_info.sql_type,
708  is_group_by,
709  query_mem_desc.getCompactByteWidth());
710  }
711  return 0;
712 }
SQLTypeInfo sql_type
Definition: TargetInfo.h:51
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:50
HOST DEVICE EncodingType get_compression() const
Definition: sqltypes.h:337
bool is_string() const
Definition: sqltypes.h:510

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

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

Referenced by TargetExprCodegenBuilder::operator()().

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

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

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

98  {
99  return target_info.is_agg && target_info.agg_kind == kCOUNT && !target_info.is_distinct;
100 }
bool is_agg
Definition: TargetInfo.h:49
SQLAgg agg_kind
Definition: TargetInfo.h:50
Definition: sqldefs.h:78
bool is_distinct
Definition: TargetInfo.h:54

+ 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(), get_target_info(), 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:329

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

102  {
103  return target_info.is_agg ? target_info.agg_arg_type.is_geometry()
104  : target_info.sql_type.is_geometry();
105 }
SQLTypeInfo sql_type
Definition: TargetInfo.h:51
SQLTypeInfo agg_arg_type
Definition: TargetInfo.h:52
bool is_agg
Definition: TargetInfo.h:49
bool is_geometry() const
Definition: sqltypes.h:522

+ Here is the call graph for this function:

+ Here is the caller graph for this function: