OmniSciDB  fe05a0c208
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros 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 217 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().

217  {
218  const auto type = ti.is_decimal() ? decimal_to_int_type(ti) : ti.get_type();
219  switch (type) {
220  case kBOOLEAN:
221  return datum.tinyintval;
222  case kTINYINT:
223  return datum.tinyintval;
224  case kSMALLINT:
225  return datum.smallintval;
226  case kCHAR:
227  case kVARCHAR:
228  case kTEXT:
230  case kINT:
231  return datum.intval;
232  case kBIGINT:
233  return datum.bigintval;
234  case kTIME:
235  case kTIMESTAMP:
236  case kDATE:
237  return datum.bigintval;
238  default:
239  abort();
240  }
241 }
int8_t tinyintval
Definition: sqltypes.h:206
#define CHECK_EQ(x, y)
Definition: Logger.h:211
Definition: sqltypes.h:48
int32_t intval
Definition: sqltypes.h:208
int64_t bigintval
Definition: sqltypes.h:209
int16_t smallintval
Definition: sqltypes.h:207
SQLTypes decimal_to_int_type(const SQLTypeInfo &ti)
Definition: Datum.cpp:419
Definition: sqltypes.h:51
Definition: sqltypes.h:52
HOST DEVICE EncodingType get_compression() const
Definition: sqltypes.h:322
Definition: sqltypes.h:40
Definition: sqltypes.h:44
bool is_decimal() const
Definition: sqltypes.h:492

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

247  {
248  return extract_from_datum(stats.max, ti);
249 }
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 243 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().

243  {
244  return extract_from_datum(stats.min, ti);
245 }
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 251 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().

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