Class GroupByAndAggregate

class GroupByAndAggregate

Public Functions

GroupByAndAggregate(Executor *executor, const ExecutorDeviceType device_type, const RelAlgExecutionUnit &ra_exe_unit, const std::vector<InputTableInfo> &query_infos, std::shared_ptr<RowSetMemoryOwner> row_set_mem_owner, const std::optional<int64_t> &group_cardinality_estimation)
bool codegen(llvm::Value *filter_result, llvm::BasicBlock *sc_false, QueryMemoryDescriptor &query_mem_desc, const CompilationOptions &co, const GpuSharedMemoryContext &gpu_smem_context)

Public Static Functions

size_t shard_count_for_top_groups(const RelAlgExecutionUnit &ra_exe_unit, const Catalog_Namespace::Catalog &catalog)

Private Functions

bool gpuCanHandleOrderEntries(const std::list<Analyzer::OrderEntry> &order_entries)
std::unique_ptr<QueryMemoryDescriptor> initQueryMemoryDescriptor(const bool allow_multifrag, const size_t max_groups_buffer_entry_count, const int8_t crt_min_byte_width, RenderInfo *render_info, const bool output_columnar_hint)
std::unique_ptr<QueryMemoryDescriptor> initQueryMemoryDescriptorImpl(const bool allow_multifrag, const size_t max_groups_buffer_entry_count, const int8_t crt_min_byte_width, const bool sort_on_gpu_hint, RenderInfo *render_info, const bool must_use_baseline_sort, const bool output_columnar_hint)
int64_t getShardedTopBucket(const ColRangeInfo &col_range_info, const size_t shard_count) const
llvm::Value *codegenOutputSlot(llvm::Value *groups_buffer, const QueryMemoryDescriptor &query_mem_desc, const CompilationOptions &co, DiamondCodegen &diamond_codegen)
std::tuple<llvm::Value *, llvm::Value *> codegenGroupBy(const QueryMemoryDescriptor &query_mem_desc, const CompilationOptions &co, DiamondCodegen &codegen)
llvm::Value *codegenVarlenOutputBuffer(const QueryMemoryDescriptor &query_mem_desc)
std::tuple<llvm::Value *, llvm::Value *> codegenSingleColumnPerfectHash(const QueryMemoryDescriptor &query_mem_desc, const CompilationOptions &co, llvm::Value *groups_buffer, llvm::Value *group_expr_lv_translated, llvm::Value *group_expr_lv_original, const int32_t row_size_quad)
std::tuple<llvm::Value *, llvm::Value *> codegenMultiColumnPerfectHash(llvm::Value *groups_buffer, llvm::Value *group_key, llvm::Value *key_size_lv, const QueryMemoryDescriptor &query_mem_desc, const int32_t row_size_quad)
llvm::Function *codegenPerfectHashFunction()
std::tuple<llvm::Value *, llvm::Value *> codegenMultiColumnBaselineHash(const CompilationOptions &co, llvm::Value *groups_buffer, llvm::Value *group_key, llvm::Value *key_size_lv, const QueryMemoryDescriptor &query_mem_desc, const size_t key_width, const int32_t row_size_quad)
ColRangeInfo getColRangeInfo()
llvm::Value *convertNullIfAny(const SQLTypeInfo &arg_type, const TargetInfo &agg_info, llvm::Value *target)
bool codegenAggCalls(const std::tuple<llvm::Value *, llvm::Value *> &agg_out_ptr_w_idx, llvm::Value *varlen_output_buffer, const std::vector<llvm::Value *> &agg_out_vec, QueryMemoryDescriptor &query_mem_desc, const CompilationOptions &co, const GpuSharedMemoryContext &gpu_smem_context, DiamondCodegen &diamond_codegen)
llvm::Value *codegenWindowRowPointer(const Analyzer::WindowFunction *window_func, const QueryMemoryDescriptor &query_mem_desc, const CompilationOptions &co, DiamondCodegen &diamond_codegen)
llvm::Value *codegenAggColumnPtr(llvm::Value *output_buffer_byte_stream, llvm::Value *out_row_idx, const std::tuple<llvm::Value *, llvm::Value *> &agg_out_ptr_w_idx, const QueryMemoryDescriptor &query_mem_desc, const size_t chosen_bytes, const size_t agg_out_off, const size_t target_idx)

: returns the pointer to where the aggregation should be stored.

void codegenEstimator(std::stack<llvm::BasicBlock *> &array_loops, DiamondCodegen &diamond_codegen, const QueryMemoryDescriptor &query_mem_desc, const CompilationOptions &co)
void codegenCountDistinct(const size_t target_idx, const Analyzer::Expr *target_expr, std::vector<llvm::Value *> &agg_args, const QueryMemoryDescriptor &query_mem_desc, const ExecutorDeviceType device_type)
void codegenApproxQuantile(const size_t target_idx, const Analyzer::Expr *target_expr, std::vector<llvm::Value *> &agg_args, const QueryMemoryDescriptor &query_mem_desc, const ExecutorDeviceType device_type)
llvm::Value *getAdditionalLiteral(const int32_t off)
std::vector<llvm::Value *> codegenAggArg(const Analyzer::Expr *target_expr, const CompilationOptions &co)
llvm::Value *emitCall(const std::string &fname, const std::vector<llvm::Value *> &args)
void checkErrorCode(llvm::Value *retCode)
bool needsUnnestDoublePatch(llvm::Value const *val_ptr, const std::string &agg_base_name, const bool threads_share_memory, const CompilationOptions &co) const
void prependForceSync()

Private Members

Executor *executor_
const RelAlgExecutionUnit &ra_exe_unit_
const std::vector<InputTableInfo> &query_infos_
std::shared_ptr<RowSetMemoryOwner> row_set_mem_owner_
bool output_columnar_
const ExecutorDeviceType device_type_
const std::optional<int64_t> group_cardinality_estimation_

Private Static Functions

int64_t getBucketedCardinality(const ColRangeInfo &col_range_info)

Friends

friend GroupByAndAggregate::Executor
friend GroupByAndAggregate::QueryMemoryDescriptor
friend GroupByAndAggregate::CodeGenerator
friend GroupByAndAggregate::ExecutionKernel
friend GroupByAndAggregate::TargetExprCodegen
friend GroupByAndAggregate::TargetExprCodegenBuilder