OmniSciDB  a5dc49c757
 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 "Shared/misc.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 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)
 
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 ColRangeInfo &group_by_range_info, 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)
 
RUNTIME_EXPORT void agg_mode_func (int64_t *agg, const int64_t 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}
 
size_t g_approx_quantile_buffer
 
size_t g_approx_quantile_centroids
 
int64_t g_bitmap_memory_limit
 
size_t g_default_max_groups_buffer_entry_guess
 
size_t g_leaf_count
 

Macro Definition Documentation

#define CUR_FUNC   executor_->cgen_state_->current_func_

Definition at line 392 of file GroupByAndAggregate.cpp.

Referenced by GroupByAndAggregate::codegenAggArg().

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

Definition at line 388 of file GroupByAndAggregate.cpp.

Referenced by GroupByAndAggregate::codegenOutputSlot().

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

Definition at line 390 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 1870 of file GroupByAndAggregate.cpp.

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

1870  {
1871  auto* t_digest = reinterpret_cast<quantile::TDigest*>(*agg);
1872  t_digest->allocate();
1873  t_digest->add(val);
1874 }
DEVICE void allocate()
Definition: quantile.h:633

+ Here is the call graph for this function:

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

Definition at line 1858 of file GroupByAndAggregate.cpp.

Referenced by agg_count_distinct_skip_val().

1858  {
1859  reinterpret_cast<CountDistinctSet*>(*agg)->insert(val);
1860 }
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 1862 of file GroupByAndAggregate.cpp.

References agg_count_distinct().

1864  {
1865  if (val != skip_val) {
1866  agg_count_distinct(agg, val);
1867  }
1868 }
RUNTIME_EXPORT void agg_count_distinct(int64_t *agg, const int64_t val)

+ Here is the call graph for this function:

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

Definition at line 1876 of file GroupByAndAggregate.cpp.

References AggMode::add().

1876  {
1877  auto* mode_map = reinterpret_cast<AggMode*>(*agg);
1878  mode_map->add(val);
1879 }
void add(Value const value)
Definition: AggMode.h:40

+ Here is the call graph for this function:

std::ostream& operator<< ( std::ostream &  out,
const ColRangeInfo info 
)

Definition at line 67 of file GroupByAndAggregate.cpp.

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

67  {
68  out << "Hash Type = " << info.hash_type_ << " min = " << info.min
69  << " max = " << info.max << " bucket = " << info.bucket
70  << " has_nulls = " << info.has_nulls << "\n";
71  return out;
72 }
QueryDescriptionType hash_type_
std::ostream& operator<< ( std::ostream &  out,
const CountDistinctImplType type 
)

Definition at line 74 of file GroupByAndAggregate.cpp.

References Bitmap, Invalid, and UnorderedSet.

74  {
75  switch (type) {
77  out << "Invalid";
78  break;
80  out << "Bitmap";
81  break;
83  out << "UnorderedSet";
84  break;
85  default:
86  out << "<Unkown Type>";
87  break;
88  }
89  return out;
90 }
std::ostream& operator<< ( std::ostream &  out,
const CountDistinctDescriptor desc 
)

Definition at line 92 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.

92  {
93  out << "Type = " << desc.impl_type_ << " min val = " << desc.min_val
94  << " bitmap_sz_bits = " << desc.bitmap_sz_bits
95  << " bool approximate = " << desc.approximate
96  << " device_type = " << desc.device_type
97  << " sub_bitmap_count = " << desc.sub_bitmap_count;
98  return out;
99 }
CountDistinctImplType impl_type_

Variable Documentation

bool g_cluster false

Definition at line 53 of file GroupByAndAggregate.cpp.

size_t g_approx_quantile_buffer

Definition at line 171 of file Execute.cpp.

size_t g_approx_quantile_centroids

Definition at line 172 of file Execute.cpp.

size_t g_default_max_groups_buffer_entry_guess

Definition at line 118 of file Execute.cpp.

size_t g_leaf_count

Definition at line 79 of file ParserNode.cpp.

size_t g_watchdog_baseline_max_groups {120000000}