OmniSciDB  cde582ebc3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GroupByAndAggregate.cpp File Reference
#include "GroupByAndAggregate.h"
#include "AggregateUtils.h"
#include "CardinalityEstimator.h"
#include "CodeGenerator.h"
#include "Descriptors/QueryMemoryDescriptor.h"
#include "ExpressionRange.h"
#include "ExpressionRewrite.h"
#include "GpuInitGroups.h"
#include "InPlaceSort.h"
#include "LLVMFunctionAttributesUtil.h"
#include "MaxwellCodegenPatch.h"
#include "OutputBufferInitialization.h"
#include "TargetExprBuilder.h"
#include "../CudaMgr/CudaMgr.h"
#include "../Shared/checked_alloc.h"
#include "../Shared/funcannotations.h"
#include "../Utils/ChunkIter.h"
#include "DataMgr/BufferMgr/BufferMgr.h"
#include "Execute.h"
#include "QueryTemplateGenerator.h"
#include "RuntimeFunctions.h"
#include "StreamingTopN.h"
#include "TopKSort.h"
#include "WindowContext.h"
#include <llvm/Transforms/Utils/BasicBlockUtils.h>
#include <cstring>
#include <limits>
#include <numeric>
#include <string_view>
#include <thread>
+ Include dependency graph for GroupByAndAggregate.cpp:

Go to the source code of this file.

Namespaces

 anonymous_namespace{GroupByAndAggregate.cpp}
 

Macros

#define LL_CONTEXT   executor_->cgen_state_->context_
 
#define LL_BUILDER   executor_->cgen_state_->ir_builder_
 
#define LL_BOOL(v)   executor_->cgen_state_->llBool(v)
 
#define LL_INT(v)   executor_->cgen_state_->llInt(v)
 
#define LL_FP(v)   executor_->cgen_state_->llFp(v)
 
#define ROW_FUNC   executor_->cgen_state_->row_func_
 
#define CUR_FUNC   executor_->cgen_state_->current_func_
 

Functions

std::ostream & operator<< (std::ostream &out, const QueryDescriptionType &type)
 
std::ostream & operator<< (std::ostream &out, const ColRangeInfo &info)
 
std::ostream & operator<< (std::ostream &out, const CountDistinctImplType &type)
 
std::ostream & operator<< (std::ostream &out, const CountDistinctDescriptor &desc)
 
int32_t anonymous_namespace{GroupByAndAggregate.cpp}::get_agg_count (const std::vector< Analyzer::Expr * > &target_exprs)
 
bool anonymous_namespace{GroupByAndAggregate.cpp}::expr_is_rowid (const Analyzer::Expr *expr, const Catalog_Namespace::Catalog &cat)
 
bool anonymous_namespace{GroupByAndAggregate.cpp}::has_count_distinct (const RelAlgExecutionUnit &ra_exe_unit)
 
bool anonymous_namespace{GroupByAndAggregate.cpp}::is_column_range_too_big_for_perfect_hash (const ColRangeInfo &col_range_info, const int64_t max_entry_count)
 
bool anonymous_namespace{GroupByAndAggregate.cpp}::cardinality_estimate_less_than_column_range (const int64_t cardinality_estimate, const ColRangeInfo &col_range_info)
 
ColRangeInfo anonymous_namespace{GroupByAndAggregate.cpp}::get_expr_range_info (const RelAlgExecutionUnit &ra_exe_unit, const std::vector< InputTableInfo > &query_infos, const Analyzer::Expr *expr, Executor *executor)
 
int64_t anonymous_namespace{GroupByAndAggregate.cpp}::get_bucketed_cardinality_without_nulls (const ColRangeInfo &col_range_info)
 
KeylessInfo anonymous_namespace{GroupByAndAggregate.cpp}::get_keyless_info (const RelAlgExecutionUnit &ra_exe_unit, const std::vector< InputTableInfo > &query_infos, const bool is_group_by, Executor *executor)
 
CountDistinctDescriptors anonymous_namespace{GroupByAndAggregate.cpp}::init_count_distinct_descriptors (const RelAlgExecutionUnit &ra_exe_unit, const std::vector< InputTableInfo > &query_infos, const ExecutorDeviceType device_type, Executor *executor)
 
RUNTIME_EXPORT void agg_count_distinct (int64_t *agg, const int64_t val)
 
RUNTIME_EXPORT void agg_count_distinct_skip_val (int64_t *agg, const int64_t val, const int64_t skip_val)
 
RUNTIME_EXPORT void agg_approx_quantile (int64_t *agg, const double val)
 

Variables

bool g_cluster false
 
bool g_bigint_count {false}
 
int g_hll_precision_bits {11}
 
size_t g_watchdog_baseline_max_groups {120000000}
 
int64_t g_bitmap_memory_limit
 
size_t g_leaf_count
 

Macro Definition Documentation

#define CUR_FUNC   executor_->cgen_state_->current_func_

Definition at line 396 of file GroupByAndAggregate.cpp.

Referenced by GroupByAndAggregate::codegenAggArg().

#define LL_BOOL (   v)    executor_->cgen_state_->llBool(v)

Definition at line 392 of file GroupByAndAggregate.cpp.

Referenced by GroupByAndAggregate::codegenOutputSlot().

#define LL_FP (   v)    executor_->cgen_state_->llFp(v)

Definition at line 394 of file GroupByAndAggregate.cpp.

Referenced by GroupByAndAggregate::codegenOutputSlot().

Function Documentation

RUNTIME_EXPORT void agg_approx_quantile ( int64_t *  agg,
const double  val 
)

Definition at line 1727 of file GroupByAndAggregate.cpp.

References quantile::detail::TDigest< RealType, IndexType >::allocate().

1727  {
1728  auto* t_digest = reinterpret_cast<quantile::TDigest*>(*agg);
1729  t_digest->allocate();
1730  t_digest->add(val);
1731 }
DEVICE void allocate()
Definition: quantile.h:601

+ Here is the call graph for this function:

RUNTIME_EXPORT void agg_count_distinct ( int64_t *  agg,
const int64_t  val 
)

Definition at line 1715 of file GroupByAndAggregate.cpp.

Referenced by agg_count_distinct_skip_val().

1715  {
1716  reinterpret_cast<CountDistinctSet*>(*agg)->insert(val);
1717 }
robin_hood::unordered_set< int64_t > CountDistinctSet
Definition: CountDistinct.h:35

+ Here is the caller graph for this function:

RUNTIME_EXPORT void agg_count_distinct_skip_val ( int64_t *  agg,
const int64_t  val,
const int64_t  skip_val 
)

Definition at line 1719 of file GroupByAndAggregate.cpp.

References agg_count_distinct().

1721  {
1722  if (val != skip_val) {
1723  agg_count_distinct(agg, val);
1724  }
1725 }
RUNTIME_EXPORT void agg_count_distinct(int64_t *agg, const int64_t val)

+ Here is the call graph for this function:

std::ostream& operator<< ( std::ostream &  out,
const QueryDescriptionType type 
)

Definition at line 59 of file GroupByAndAggregate.cpp.

References Estimator, GroupByBaselineHash, GroupByPerfectHash, NonGroupedAggregate, Projection, and TableFunction.

59  {
60  switch (type) {
62  out << "GroupByPerfectHash";
63  break;
65  out << "GroupByBaselineHash";
66  break;
68  out << "Projection";
69  break;
71  out << "TableFunction";
72  break;
74  out << "NonGroupedAggregate";
75  break;
77  out << "Estimator";
78  break;
79  default:
80  out << "Unknown QueryDescriptionType";
81  }
82  return out;
83 }
std::ostream& operator<< ( std::ostream &  out,
const ColRangeInfo info 
)

Definition at line 89 of file GroupByAndAggregate.cpp.

References ColRangeInfo::bucket, ColRangeInfo::has_nulls, ColRangeInfo::hash_type_, ColRangeInfo::max, and ColRangeInfo::min.

89  {
90  out << "Hash Type = " << info.hash_type_ << " min = " << info.min
91  << " max = " << info.max << " bucket = " << info.bucket
92  << " has_nulls = " << info.has_nulls << "\n";
93  return out;
94 }
QueryDescriptionType hash_type_
std::ostream& operator<< ( std::ostream &  out,
const CountDistinctImplType type 
)

Definition at line 96 of file GroupByAndAggregate.cpp.

References Bitmap, Invalid, and UnorderedSet.

96  {
97  switch (type) {
99  out << "Invalid";
100  break;
102  out << "Bitmap";
103  break;
105  out << "UnorderedSet";
106  break;
107  default:
108  out << "<Unkown Type>";
109  break;
110  }
111  return out;
112 }
std::ostream& operator<< ( std::ostream &  out,
const CountDistinctDescriptor desc 
)

Definition at line 114 of file GroupByAndAggregate.cpp.

References CountDistinctDescriptor::approximate, CountDistinctDescriptor::bitmap_sz_bits, CountDistinctDescriptor::device_type, CountDistinctDescriptor::impl_type_, CountDistinctDescriptor::min_val, and CountDistinctDescriptor::sub_bitmap_count.

114  {
115  out << "Type = " << desc.impl_type_ << " min val = " << desc.min_val
116  << " bitmap_sz_bits = " << desc.bitmap_sz_bits
117  << " bool approximate = " << desc.approximate
118  << " device_type = " << desc.device_type
119  << " sub_bitmap_count = " << desc.sub_bitmap_count;
120  return out;
121 }
CountDistinctImplType impl_type_

Variable Documentation

bool g_cluster false

Definition at line 52 of file GroupByAndAggregate.cpp.

size_t g_leaf_count

Definition at line 76 of file ParserNode.cpp.

size_t g_watchdog_baseline_max_groups {120000000}