OmniSciDB
a575cb28ea
|
#include <WindowContext.h>
Classes | |
struct | AggregateState |
Public Types | |
using | Comparator = std::function< bool(const int64_t lhs, const int64_t rhs)> |
Public Member Functions | |
WindowFunctionContext (const Analyzer::WindowFunction *window_func, const std::shared_ptr< HashJoin > &partitions, const size_t elem_count, const ExecutorDeviceType device_type, std::shared_ptr< RowSetMemoryOwner > row_set_mem_owner) | |
WindowFunctionContext (const WindowFunctionContext &)=delete | |
WindowFunctionContext & | operator= (const WindowFunctionContext &)=delete |
~WindowFunctionContext () | |
void | addOrderColumn (const int8_t *column, const Analyzer::ColumnVar *col_var, const std::vector< std::shared_ptr< Chunk_NS::Chunk >> &chunks_owner) |
void | compute () |
const Analyzer::WindowFunction * | getWindowFunction () const |
const int8_t * | output () const |
const int64_t * | aggregateState () const |
const int64_t * | aggregateStateCount () const |
int64_t | aggregateStatePendingOutputs () const |
const int8_t * | partitionStart () const |
const int8_t * | partitionEnd () const |
size_t | elementCount () const |
void | setRowNumber (llvm::Value *row_number) |
llvm::Value * | getRowNumber () const |
Private Member Functions | |
void | computePartition (int64_t *output_for_partition_buff, const size_t partition_size, const size_t off, const Analyzer::WindowFunction *window_func, const std::function< bool(const int64_t lhs, const int64_t rhs)> &comparator) |
void | fillPartitionStart () |
void | fillPartitionEnd () |
const int32_t * | payload () const |
const int32_t * | offsets () const |
const int32_t * | counts () const |
size_t | partitionCount () const |
Static Private Member Functions | |
static Comparator | makeComparator (const Analyzer::ColumnVar *col_var, const int8_t *partition_values, const int32_t *partition_indices, const bool nulls_first) |
Private Attributes | |
const Analyzer::WindowFunction * | window_func_ |
std::vector< std::vector < std::shared_ptr < Chunk_NS::Chunk > > > | order_columns_owner_ |
std::vector< const int8_t * > | order_columns_ |
std::shared_ptr< HashJoin > | partitions_ |
size_t | elem_count_ |
int8_t * | output_ |
int8_t * | partition_start_ |
int8_t * | partition_end_ |
AggregateState | aggregate_state_ |
const ExecutorDeviceType | device_type_ |
std::shared_ptr < RowSetMemoryOwner > | row_set_mem_owner_ |
Definition at line 66 of file WindowContext.h.
using WindowFunctionContext::Comparator = std::function<bool(const int64_t lhs, const int64_t rhs)> |
Definition at line 118 of file WindowContext.h.
WindowFunctionContext::WindowFunctionContext | ( | const Analyzer::WindowFunction * | window_func, |
const std::shared_ptr< HashJoin > & | partitions, | ||
const size_t | elem_count, | ||
const ExecutorDeviceType | device_type, | ||
std::shared_ptr< RowSetMemoryOwner > | row_set_mem_owner | ||
) |
Definition at line 29 of file WindowContext.cpp.
|
delete |
WindowFunctionContext::~WindowFunctionContext | ( | ) |
void WindowFunctionContext::addOrderColumn | ( | const int8_t * | column, |
const Analyzer::ColumnVar * | col_var, | ||
const std::vector< std::shared_ptr< Chunk_NS::Chunk >> & | chunks_owner | ||
) |
Definition at line 49 of file WindowContext.cpp.
References order_columns_, and order_columns_owner_.
const int64_t * WindowFunctionContext::aggregateState | ( | ) | const |
Definition at line 491 of file WindowContext.cpp.
References aggregate_state_, CHECK, Analyzer::WindowFunction::getKind(), WindowFunctionContext::AggregateState::val, window_func_, and window_function_is_aggregate().
const int64_t * WindowFunctionContext::aggregateStateCount | ( | ) | const |
Definition at line 496 of file WindowContext.cpp.
References aggregate_state_, CHECK, WindowFunctionContext::AggregateState::count, Analyzer::WindowFunction::getKind(), window_func_, and window_function_is_aggregate().
int64_t WindowFunctionContext::aggregateStatePendingOutputs | ( | ) | const |
Definition at line 501 of file WindowContext.cpp.
References aggregate_state_, CHECK, Analyzer::WindowFunction::getKind(), WindowFunctionContext::AggregateState::outputs, window_func_, and window_function_is_aggregate().
void WindowFunctionContext::compute | ( | ) |
Definition at line 403 of file WindowContext.cpp.
References CHECK, CHECK_EQ, computePartition(), gpu_enabled::copy(), counts(), elem_count_, fillPartitionEnd(), fillPartitionStart(), Analyzer::WindowFunction::getCollation(), Analyzer::WindowFunction::getKind(), Analyzer::WindowFunction::getOrderKeys(), generate_TableFunctionsFactory_init::i, gpu_enabled::iota(), makeComparator(), offsets(), order_columns_, output_, partitionCount(), payload(), row_set_mem_owner_, gpu_enabled::sort(), window_func_, anonymous_namespace{WindowContext.cpp}::window_function_buffer_element_size(), window_function_is_aggregate(), window_function_is_value(), and window_function_requires_peer_handling().
|
private |
Definition at line 645 of file WindowContext.cpp.
References anonymous_namespace{WindowContext.cpp}::apply_first_value_to_partition(), anonymous_namespace{WindowContext.cpp}::apply_lag_to_partition(), anonymous_namespace{WindowContext.cpp}::apply_last_value_to_partition(), anonymous_namespace{WindowContext.cpp}::apply_permutation_to_partition(), run_benchmark_import::args, AVG, CHECK_EQ, gpu_enabled::copy(), COUNT, CUME_DIST, DENSE_RANK, FIRST_VALUE, anonymous_namespace{WindowContext.cpp}::get_int_constant_from_expr(), anonymous_namespace{WindowContext.cpp}::get_lag_or_lead_argument(), Analyzer::WindowFunction::getArgs(), Analyzer::WindowFunction::getKind(), anonymous_namespace{WindowContext.cpp}::index_to_cume_dist(), anonymous_namespace{WindowContext.cpp}::index_to_dense_rank(), anonymous_namespace{WindowContext.cpp}::index_to_ntile(), anonymous_namespace{WindowContext.cpp}::index_to_partition_end(), anonymous_namespace{WindowContext.cpp}::index_to_percent_rank(), anonymous_namespace{WindowContext.cpp}::index_to_rank(), anonymous_namespace{WindowContext.cpp}::index_to_row_number(), LAG, LAST_VALUE, LEAD, MAX, MIN, NTILE, partitionEnd(), payload(), PERCENT_RANK, RANK, ROW_NUMBER, SUM, toString(), and window_function_requires_peer_handling().
Referenced by compute().
|
private |
Definition at line 788 of file WindowContext.cpp.
References device_type_, and partitions_.
Referenced by compute(), fillPartitionEnd(), fillPartitionStart(), and partitionCount().
size_t WindowFunctionContext::elementCount | ( | ) | const |
|
private |
Definition at line 754 of file WindowContext.cpp.
References agg_count_distinct_bitmap(), Bitmap, checked_calloc(), counts(), CPU, elem_count_, generate_TableFunctionsFactory_init::i, gpu_enabled::partial_sum(), partition_end_, and partitionCount().
Referenced by compute().
|
private |
Definition at line 735 of file WindowContext.cpp.
References agg_count_distinct_bitmap(), Bitmap, checked_calloc(), counts(), CPU, elem_count_, generate_TableFunctionsFactory_init::i, gpu_enabled::partial_sum(), partition_start_, and partitionCount().
Referenced by compute().
llvm::Value * WindowFunctionContext::getRowNumber | ( | ) | const |
Definition at line 522 of file WindowContext.cpp.
References aggregate_state_, and WindowFunctionContext::AggregateState::row_number.
const Analyzer::WindowFunction * WindowFunctionContext::getWindowFunction | ( | ) | const |
Definition at line 483 of file WindowContext.cpp.
References window_func_.
Referenced by Executor::codegenWindowFunction().
|
staticprivate |
Definition at line 581 of file WindowContext.cpp.
References logger::FATAL, Analyzer::Expr::get_type_info(), kDOUBLE, kFLOAT, and LOG.
Referenced by compute().
|
private |
Definition at line 783 of file WindowContext.cpp.
References device_type_, and partitions_.
Referenced by compute(), and partitionCount().
|
delete |
const int8_t * WindowFunctionContext::output | ( | ) | const |
Definition at line 487 of file WindowContext.cpp.
References output_.
Referenced by CodeGenerator::codegenWindowPosition().
|
private |
Definition at line 793 of file WindowContext.cpp.
References CHECK_GE, counts(), and offsets().
Referenced by compute(), fillPartitionEnd(), and fillPartitionStart().
const int8_t * WindowFunctionContext::partitionEnd | ( | ) | const |
Definition at line 510 of file WindowContext.cpp.
References partition_end_.
Referenced by computePartition().
const int8_t * WindowFunctionContext::partitionStart | ( | ) | const |
|
private |
Definition at line 778 of file WindowContext.cpp.
References device_type_, and partitions_.
Referenced by compute(), and computePartition().
void WindowFunctionContext::setRowNumber | ( | llvm::Value * | row_number | ) |
Definition at line 518 of file WindowContext.cpp.
References aggregate_state_, and WindowFunctionContext::AggregateState::row_number.
Referenced by CodeGenerator::codegenWindowPosition().
|
private |
Definition at line 171 of file WindowContext.h.
Referenced by aggregateState(), aggregateStateCount(), aggregateStatePendingOutputs(), getRowNumber(), and setRowNumber().
|
private |
Definition at line 172 of file WindowContext.h.
|
private |
Definition at line 161 of file WindowContext.h.
Referenced by compute(), elementCount(), fillPartitionEnd(), and fillPartitionStart().
|
private |
Definition at line 157 of file WindowContext.h.
Referenced by addOrderColumn(), and compute().
|
private |
Definition at line 155 of file WindowContext.h.
Referenced by addOrderColumn().
|
private |
Definition at line 163 of file WindowContext.h.
|
private |
Definition at line 169 of file WindowContext.h.
Referenced by fillPartitionEnd(), partitionEnd(), and ~WindowFunctionContext().
|
private |
Definition at line 166 of file WindowContext.h.
Referenced by fillPartitionStart(), partitionStart(), and ~WindowFunctionContext().
|
private |
Definition at line 159 of file WindowContext.h.
|
private |
Definition at line 173 of file WindowContext.h.
Referenced by compute().
|
private |
Definition at line 153 of file WindowContext.h.
Referenced by aggregateState(), aggregateStateCount(), aggregateStatePendingOutputs(), compute(), and getWindowFunction().