OmniSciDB  eb3a3d0a03
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GroupByAndAggregate.h File Reference
#include "BufferCompaction.h"
#include "ColumnarResults.h"
#include "CompilationOptions.h"
#include "GpuMemUtils.h"
#include "GpuSharedMemoryContext.h"
#include "InputMetadata.h"
#include "QueryExecutionContext.h"
#include "Rendering/RenderInfo.h"
#include "RuntimeFunctions.h"
#include "QueryEngine/Utils/DiamondCodegen.h"
#include "../Shared/sqltypes.h"
#include "Logger/Logger.h"
#include <llvm/IR/Function.h>
#include <llvm/IR/Instructions.h>
#include <llvm/IR/Value.h>
#include <boost/algorithm/string/join.hpp>
#include <boost/make_unique.hpp>
#include <stack>
#include <vector>
+ Include dependency graph for GroupByAndAggregate.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  ColRangeInfo
 
struct  KeylessInfo
 
class  GroupByAndAggregate
 

Functions

int64_t extract_from_datum (const Datum datum, const SQLTypeInfo &ti)
 
int64_t extract_min_stat (const ChunkStats &stats, const SQLTypeInfo &ti)
 
int64_t extract_max_stat (const ChunkStats &stats, const SQLTypeInfo &ti)
 
size_t get_count_distinct_sub_bitmap_count (const size_t bitmap_sz_bits, const RelAlgExecutionUnit &ra_exe_unit, const ExecutorDeviceType device_type)
 

Variables

bool g_enable_smem_group_by
 
bool g_bigint_count
 

Function Documentation

int64_t extract_from_datum ( const Datum  datum,
const SQLTypeInfo ti 
)
inline

Definition at line 220 of file GroupByAndAggregate.h.

References Datum::bigintval, CHECK_EQ, decimal_to_int_type(), SQLTypeInfo::get_compression(), SQLTypeInfo::get_type(), Datum::intval, SQLTypeInfo::is_decimal(), kBIGINT, kBOOLEAN, kCHAR, kDATE, kENCODING_DICT, kINT, kSMALLINT, kTEXT, kTIME, kTIMESTAMP, kTINYINT, kVARCHAR, Datum::smallintval, Datum::tinyintval, and run_benchmark_import::type.

Referenced by extract_max_stat(), and extract_min_stat().

220  {
221  const auto type = ti.is_decimal() ? decimal_to_int_type(ti) : ti.get_type();
222  switch (type) {
223  case kBOOLEAN:
224  return datum.tinyintval;
225  case kTINYINT:
226  return datum.tinyintval;
227  case kSMALLINT:
228  return datum.smallintval;
229  case kCHAR:
230  case kVARCHAR:
231  case kTEXT:
233  case kINT:
234  return datum.intval;
235  case kBIGINT:
236  return datum.bigintval;
237  case kTIME:
238  case kTIMESTAMP:
239  case kDATE:
240  return datum.bigintval;
241  default:
242  abort();
243  }
244 }
int8_t tinyintval
Definition: sqltypes.h:212
#define CHECK_EQ(x, y)
Definition: Logger.h:217
Definition: sqltypes.h:49
int32_t intval
Definition: sqltypes.h:214
int64_t bigintval
Definition: sqltypes.h:215
int16_t smallintval
Definition: sqltypes.h:213
SQLTypes decimal_to_int_type(const SQLTypeInfo &ti)
Definition: Datum.cpp:451
Definition: sqltypes.h:52
Definition: sqltypes.h:53
HOST DEVICE EncodingType get_compression() const
Definition: sqltypes.h:337
Definition: sqltypes.h:41
Definition: sqltypes.h:45
bool is_decimal() const
Definition: sqltypes.h:507

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int64_t extract_max_stat ( const ChunkStats stats,
const SQLTypeInfo ti 
)
inline

Definition at line 250 of file GroupByAndAggregate.h.

References extract_from_datum(), and ChunkStats::max.

Referenced by getLeafColumnRange(), Executor::isFragmentFullyDeleted(), anonymous_namespace{StorageIOFacility.h}::should_recompute_metadata(), and Executor::skipFragment().

250  {
251  return extract_from_datum(stats.max, ti);
252 }
int64_t extract_from_datum(const Datum datum, const SQLTypeInfo &ti)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int64_t extract_min_stat ( const ChunkStats stats,
const SQLTypeInfo ti 
)
inline

Definition at line 246 of file GroupByAndAggregate.h.

References extract_from_datum(), and ChunkStats::min.

Referenced by getLeafColumnRange(), Executor::isFragmentFullyDeleted(), anonymous_namespace{StorageIOFacility.h}::should_recompute_metadata(), and Executor::skipFragment().

246  {
247  return extract_from_datum(stats.min, ti);
248 }
int64_t extract_from_datum(const Datum datum, const SQLTypeInfo &ti)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

size_t get_count_distinct_sub_bitmap_count ( const size_t  bitmap_sz_bits,
const RelAlgExecutionUnit ra_exe_unit,
const ExecutorDeviceType  device_type 
)
inline

Definition at line 254 of file GroupByAndAggregate.h.

References g_cluster, GPU, and RelAlgExecutionUnit::groupby_exprs.

Referenced by anonymous_namespace{RelAlgExecutor.cpp}::decide_approx_count_distinct_implementation(), and anonymous_namespace{GroupByAndAggregate.cpp}::init_count_distinct_descriptors().

256  {
257  // For count distinct on a column with a very small number of distinct values
258  // contention can be very high, especially for non-grouped queries. We'll split
259  // the bitmap into multiple sub-bitmaps which are unified to get the full result.
260  // The threshold value for bitmap_sz_bits works well on Kepler.
261  return bitmap_sz_bits < 50000 && ra_exe_unit.groupby_exprs.empty() &&
262  (device_type == ExecutorDeviceType::GPU || g_cluster)
263  ? 64 // NB: must be a power of 2 to keep runtime offset computations cheap
264  : 1;
265 }
const std::list< std::shared_ptr< Analyzer::Expr > > groupby_exprs
bool g_cluster

+ Here is the caller graph for this function:

Variable Documentation

bool g_bigint_count

Definition at line 52 of file GroupByAndAggregate.cpp.

bool g_enable_smem_group_by