OmniSciDB
a5dc49c757
|
#include <ResultSetStorage.h>
Public Member Functions | |
void | reduce (const ResultSetStorage &that, const std::vector< std::string > &serialized_varlen_buffer, const ReductionCode &reduction_code, const size_t executor_id) const |
void | rewriteAggregateBufferOffsets (const std::vector< std::string > &serialized_varlen_buffer) const |
int8_t * | getUnderlyingBuffer () const |
size_t | getEntryCount () const |
template<class KeyType > | |
void | moveEntriesToBuffer (int8_t *new_buff, const size_t new_entry_count) const |
template<class KeyType > | |
void | moveOneEntryToBuffer (const size_t entry_index, int64_t *new_buff_i64, const size_t new_entry_count, const size_t key_count, const size_t row_qw_count, const int64_t *src_buff, const size_t key_byte_width) const |
void | updateEntryCount (const size_t new_entry_count) |
void | reduceOneApproxQuantileSlot (int8_t *this_ptr1, const int8_t *that_ptr1, const size_t target_logical_idx, const ResultSetStorage &that) const |
Static Public Member Functions | |
static bool | reduceSingleRow (const int8_t *row_ptr, const int8_t warp_count, const bool is_columnar, const bool replace_bitmap_ptr_with_bitmap_sz, std::vector< int64_t > &agg_vals, const QueryMemoryDescriptor &query_mem_desc, const std::vector< TargetInfo > &targets, const std::vector< int64_t > &agg_init_vals) |
Private Member Functions | |
ResultSetStorage (const std::vector< TargetInfo > &targets, const QueryMemoryDescriptor &query_mem_desc, int8_t *buff, const bool buff_is_provided) | |
void | reduceEntriesNoCollisionsColWise (int8_t *this_buff, const int8_t *that_buff, const ResultSetStorage &that, const size_t start_index, const size_t end_index, const std::vector< std::string > &serialized_varlen_buffer, const size_t executor_id) const |
void | copyKeyColWise (const size_t entry_idx, int8_t *this_buff, const int8_t *that_buff) const |
bool | isEmptyEntry (const size_t entry_idx, const int8_t *buff) const |
bool | isEmptyEntry (const size_t entry_idx) const |
bool | isEmptyEntryColumnar (const size_t entry_idx, const int8_t *buff) const |
void | reduceOneEntryBaseline (int8_t *this_buff, const int8_t *that_buff, const size_t i, const size_t that_entry_count, const ResultSetStorage &that) const |
void | reduceOneEntrySlotsBaseline (int64_t *this_entry_slots, const int64_t *that_buff, const size_t that_entry_idx, const size_t that_entry_count, const ResultSetStorage &that) const |
void | initializeBaselineValueSlots (int64_t *this_entry_slots) const |
void | reduceOneSlotBaseline (int64_t *this_buff, const size_t this_slot, const int64_t *that_buff, const size_t that_entry_count, const size_t that_slot, const TargetInfo &target_info, const size_t target_logical_idx, const size_t target_slot_idx, const size_t init_agg_val_idx, const ResultSetStorage &that) const |
ALWAYS_INLINE void | reduceOneSlotSingleValue (int8_t *this_ptr1, const TargetInfo &target_info, const size_t target_slot_idx, const size_t init_agg_val_idx, const int8_t *that_ptr1) const |
ALWAYS_INLINE void | reduceOneSlot (int8_t *this_ptr1, int8_t *this_ptr2, const int8_t *that_ptr1, const int8_t *that_ptr2, const TargetInfo &target_info, const size_t target_logical_idx, const size_t target_slot_idx, const size_t init_agg_val_idx, const ResultSetStorage &that, const size_t first_slot_idx_for_target, const std::vector< std::string > &serialized_varlen_buffer) const |
void | reduceOneCountDistinctSlot (int8_t *this_ptr1, const int8_t *that_ptr1, const size_t target_logical_idx, const ResultSetStorage &that) const |
void | fillOneEntryRowWise (const std::vector< int64_t > &entry) |
void | fillOneEntryColWise (const std::vector< int64_t > &entry) |
void | initializeRowWise () const |
void | initializeColWise () const |
const VarlenOutputInfo * | getVarlenOutputInfo () const |
void | addCountDistinctSetPointerMapping (const int64_t remote_ptr, const int64_t ptr) |
int64_t | mappedPtr (const int64_t) const |
size_t | binSearchRowCount () const |
Private Attributes | |
const std::vector< TargetInfo > | targets_ |
QueryMemoryDescriptor | query_mem_desc_ |
int8_t * | buff_ |
const bool | buff_is_provided_ |
std::vector< int64_t > | target_init_vals_ |
std::unordered_map< int64_t, int64_t > | count_distinct_sets_mapping_ |
std::shared_ptr< VarlenOutputInfo > | varlen_output_info_ |
Friends | |
class | ResultSet |
class | ResultSetManager |
Definition at line 96 of file ResultSetStorage.h.
|
private |
Definition at line 53 of file ResultSetStorage.cpp.
|
private |
Definition at line 67 of file ResultSetStorage.cpp.
References CHECK, and count_distinct_sets_mapping_.
|
private |
Definition at line 2575 of file ResultSetIteration.cpp.
References CHECK, CHECK_EQ, QueryMemoryDescriptor::didOutputColumnar(), EMPTY_KEY_64, QueryMemoryDescriptor::getEffectiveKeyWidth(), QueryMemoryDescriptor::getEntryCount(), QueryMemoryDescriptor::getQueryDescriptionType(), anonymous_namespace{ResultSetIteration.cpp}::make_bin_search(), heavyai::Projection, ResultSet::query_mem_desc_, and row_ptr_rowwise().
|
private |
Definition at line 505 of file ResultSetReduction.cpp.
References CHECK, QueryMemoryDescriptor::didOutputColumnar(), QueryMemoryDescriptor::getGroupbyColCount(), QueryMemoryDescriptor::getPrependedGroupColOffInBytes(), QueryMemoryDescriptor::groupColWidth(), and query_mem_desc_.
Referenced by reduceEntriesNoCollisionsColWise().
|
private |
Definition at line 1195 of file ResultSetReduction.cpp.
References buff_, CHECK, CHECK_EQ, QueryMemoryDescriptor::didOutputColumnar(), QueryMemoryDescriptor::getBufferColSlotCount(), QueryMemoryDescriptor::getEntryCount(), QueryMemoryDescriptor::getGroupbyColCount(), key_offset_colwise(), query_mem_desc_, slot_offset_colwise(), and target_init_vals_.
|
private |
Definition at line 1142 of file ResultSetReduction.cpp.
References buff_, CHECK, CHECK_EQ, QueryMemoryDescriptor::didOutputColumnar(), QueryMemoryDescriptor::getBufferColSlotCount(), QueryMemoryDescriptor::getEffectiveKeyWidth(), QueryMemoryDescriptor::getEntryCount(), QueryMemoryDescriptor::getGroupbyColCount(), key_offset_rowwise(), query_mem_desc_, slot_offset_rowwise(), and target_init_vals_.
|
inline |
Definition at line 114 of file ResultSetStorage.h.
References QueryMemoryDescriptor::getEntryCount(), and query_mem_desc_.
int8_t * ResultSetStorage::getUnderlyingBuffer | ( | ) | const |
Definition at line 63 of file ResultSetStorage.cpp.
References buff_.
Referenced by anonymous_namespace{Execute.cpp}::permute_storage_columnar(), and anonymous_namespace{Execute.cpp}::permute_storage_row_wise().
|
inlineprivate |
Definition at line 223 of file ResultSetStorage.h.
References varlen_output_info_.
|
private |
Definition at line 1234 of file ResultSetReduction.cpp.
References CHECK, QueryMemoryDescriptor::didOutputColumnar(), QueryMemoryDescriptor::getEntryCount(), query_mem_desc_, and target_init_vals_.
|
private |
Definition at line 1214 of file ResultSetReduction.cpp.
References buff_, CHECK, EMPTY_KEY_64, QueryMemoryDescriptor::getEntryCount(), QueryMemoryDescriptor::getGroupbyColCount(), QueryMemoryDescriptor::hasKeylessHash(), key_offset_colwise(), query_mem_desc_, slot_offset_colwise(), and target_init_vals_.
|
private |
Definition at line 1160 of file ResultSetReduction.cpp.
References align_to_int64(), buff_, CHECK, CHECK_EQ, anonymous_namespace{ResultSetReduction.cpp}::fill_empty_key_32(), anonymous_namespace{ResultSetReduction.cpp}::fill_empty_key_64(), get_key_bytes_rowwise(), get_row_bytes(), QueryMemoryDescriptor::getEffectiveKeyWidth(), QueryMemoryDescriptor::getEntryCount(), QueryMemoryDescriptor::getGroupbyColCount(), QueryMemoryDescriptor::hasKeylessHash(), query_mem_desc_, and target_init_vals_.
|
private |
Definition at line 2457 of file ResultSetIteration.cpp.
References CHECK, CHECK_GE, CHECK_LT, QueryMemoryDescriptor::didOutputColumnar(), EMPTY_KEY_32, EMPTY_KEY_64, result_set::get_byteoff_of_slot(), QueryMemoryDescriptor::getEffectiveKeyWidth(), QueryMemoryDescriptor::getPaddedSlotWidthBytes(), QueryMemoryDescriptor::getQueryDescriptionType(), QueryMemoryDescriptor::getTargetIdxForKey(), heavyai::GroupByPerfectHash, QueryMemoryDescriptor::hasKeylessHash(), heavyai::NonGroupedAggregate, ResultSet::query_mem_desc_, read_int_from_buff(), and row_ptr_rowwise().
Referenced by reduceOneEntryBaseline(), and rewriteAggregateBufferOffsets().
|
private |
Definition at line 2597 of file ResultSetIteration.cpp.
|
private |
Definition at line 2498 of file ResultSetIteration.cpp.
References anonymous_namespace{ResultSetIteration.cpp}::advance_col_buff_to_slot(), CHECK, CHECK_GE, CHECK_LT, QueryMemoryDescriptor::didOutputColumnar(), EMPTY_KEY_16, EMPTY_KEY_32, EMPTY_KEY_64, EMPTY_KEY_8, QueryMemoryDescriptor::getGroupbyColCount(), QueryMemoryDescriptor::getPaddedSlotWidthBytes(), QueryMemoryDescriptor::getPrependedGroupColOffInBytes(), QueryMemoryDescriptor::getQueryDescriptionType(), QueryMemoryDescriptor::getTargetIdxForKey(), heavyai::GroupByPerfectHash, QueryMemoryDescriptor::groupColWidth(), QueryMemoryDescriptor::hasKeylessHash(), heavyai::NonGroupedAggregate, heavyai::Projection, ResultSet::query_mem_desc_, read_int_from_buff(), heavyai::TableFunction, and ResultSet::targets_.
Referenced by reduceEntriesNoCollisionsColWise().
|
private |
Definition at line 73 of file ResultSetStorage.cpp.
References count_distinct_sets_mapping_.
void ResultSetStorage::moveEntriesToBuffer | ( | int8_t * | new_buff, |
const size_t | new_entry_count | ||
) | const |
Definition at line 940 of file ResultSetReduction.cpp.
References threading_serial::async(), buff_, CHECK, CHECK_GT, cpu_threads(), anonymous_namespace{ResultSetReduction.cpp}::get_row_qw_count(), QueryMemoryDescriptor::getEffectiveKeyWidth(), QueryMemoryDescriptor::getEntryCount(), QueryMemoryDescriptor::getGroupbyColCount(), QueryMemoryDescriptor::getQueryDescriptionType(), heavyai::GroupByBaselineHash, QueryMemoryDescriptor::hasKeylessHash(), query_mem_desc_, and anonymous_namespace{ResultSetReduction.cpp}::use_multithreaded_reduction().
void ResultSetStorage::moveOneEntryToBuffer | ( | const size_t | entry_index, |
int64_t * | new_buff_i64, | ||
const size_t | new_entry_count, | ||
const size_t | key_count, | ||
const size_t | row_qw_count, | ||
const int64_t * | src_buff, | ||
const size_t | key_byte_width | ||
) | const |
Definition at line 1004 of file ResultSetReduction.cpp.
References CHECK, QueryMemoryDescriptor::didOutputColumnar(), anonymous_namespace{ResultSetReduction.cpp}::fill_slots(), get_group_value(), get_group_value_columnar(), QueryMemoryDescriptor::getEntryCount(), key_offset_colwise(), anonymous_namespace{ResultSetReduction.cpp}::make_key(), and query_mem_desc_.
void ResultSetStorage::reduce | ( | const ResultSetStorage & | that, |
const std::vector< std::string > & | serialized_varlen_buffer, | ||
const ReductionCode & | reduction_code, | ||
const size_t | executor_id | ||
) | const |
Definition at line 202 of file ResultSetReduction.cpp.
References threading_serial::async(), buff_, CHECK, CHECK_EQ, CHECK_GE, CHECK_GT, cpu_threads(), QueryMemoryDescriptor::didOutputColumnar(), QueryMemoryDescriptor::getEntryCount(), QueryMemoryDescriptor::getQueryDescriptionType(), heavyai::GroupByBaselineHash, heavyai::GroupByPerfectHash, ReductionCode::ir_reduce_loop, heavyai::NonGroupedAggregate, query_mem_desc_, reduceOneEntryBaseline(), anonymous_namespace{ResultSetReduction.cpp}::run_reduction_code(), and anonymous_namespace{ResultSetReduction.cpp}::use_multithreaded_reduction().
Referenced by reduceOneSlotSingleValue().
|
private |
Definition at line 406 of file ResultSetReduction.cpp.
References advance_to_next_columnar_target_buff(), CHECK, anonymous_namespace{ResultSetReduction.cpp}::check_watchdog(), copyKeyColWise(), g_enable_dynamic_watchdog, g_enable_non_kernel_time_query_interrupt, get_cols_ptr(), QueryMemoryDescriptor::getColSlotContext(), Executor::getExecutor(), QueryMemoryDescriptor::getPaddedSlotWidthBytes(), QueryMemoryDescriptor::hasKeylessHash(), isEmptyEntryColumnar(), kAVG, kSAMPLE, LIKELY, query_mem_desc_, reduceOneSlot(), targets_, and UNLIKELY.
void ResultSetStorage::reduceOneApproxQuantileSlot | ( | int8_t * | this_ptr1, |
const int8_t * | that_ptr1, | ||
const size_t | target_logical_idx, | ||
const ResultSetStorage & | that | ||
) | const |
Definition at line 1600 of file ResultSetReduction.cpp.
References CHECK, CHECK_LT, QueryMemoryDescriptor::getCountDistinctDescriptorsSize(), and query_mem_desc_.
Referenced by reduceOneSlot().
|
private |
Definition at line 1620 of file ResultSetReduction.cpp.
References CHECK, CHECK_LT, count_distinct_set_union(), QueryMemoryDescriptor::getCountDistinctDescriptor(), QueryMemoryDescriptor::getCountDistinctDescriptorsSize(), Invalid, and query_mem_desc_.
Referenced by reduceOneSlot().
|
private |
Definition at line 829 of file ResultSetReduction.cpp.
References CHECK, anonymous_namespace{ResultSetReduction.cpp}::check_watchdog_with_seed(), QueryMemoryDescriptor::didOutputColumnar(), anonymous_namespace{ResultSetReduction.cpp}::fill_slots(), g_enable_dynamic_watchdog, anonymous_namespace{ResultSetReduction.cpp}::get_group_value_columnar_reduction(), QueryMemoryDescriptor::getEntryCount(), QueryMemoryDescriptor::getGroupbyColCount(), QueryMemoryDescriptor::getQueryDescriptionType(), heavyai::GroupByBaselineHash, QueryMemoryDescriptor::hasKeylessHash(), isEmptyEntry(), key_offset_colwise(), anonymous_namespace{ResultSetReduction.cpp}::make_key(), query_mem_desc_, and reduceOneEntrySlotsBaseline().
Referenced by reduce().
|
private |
Definition at line 866 of file ResultSetReduction.cpp.
References advance_slot(), CHECK, QueryMemoryDescriptor::didOutputColumnar(), QueryMemoryDescriptor::getEntryCount(), QueryMemoryDescriptor::getGroupbyColCount(), QueryMemoryDescriptor::getTargetGroupbyIndex(), query_mem_desc_, reduceOneSlotBaseline(), slot_offset_colwise(), QueryMemoryDescriptor::targetGroupbyIndicesSize(), and targets_.
Referenced by reduceOneEntryBaseline().
|
private |
Definition at line 1454 of file ResultSetReduction.cpp.
References TargetInfo::agg_kind, AGGREGATE_ONE_COUNT, AGGREGATE_ONE_NULLABLE_VALUE, AGGREGATE_ONE_NULLABLE_VALUE_SMALL, CHECK, CHECK_EQ, CHECK_LT, logger::FATAL, SQLTypeInfo::get_elem_type(), result_set::get_width_for_slot(), QueryMemoryDescriptor::getPaddedSlotWidthBytes(), QueryMemoryDescriptor::getTargetGroupbyIndex(), TargetInfo::is_agg, is_distinct_target(), SQLTypeInfo::is_geometry(), SQLTypeInfo::is_string(), SQLTypeInfo::is_varlen(), QueryMemoryDescriptor::isLogicalSizedColumnsAllowed(), kAPPROX_COUNT_DISTINCT, kAPPROX_QUANTILE, kAVG, kCOUNT, kCOUNT_IF, kMAX, kMIN, kSAMPLE, kSINGLE_VALUE, kSUM, kSUM_IF, LOG, query_mem_desc_, reduceOneApproxQuantileSlot(), reduceOneCountDistinctSlot(), reduceOneSlotSingleValue(), TargetInfo::sql_type, takes_float_argument(), target_init_vals_, QueryMemoryDescriptor::targetGroupbyIndicesSize(), toString(), and UNREACHABLE.
Referenced by reduceEntriesNoCollisionsColWise(), and reduceOneSlotBaseline().
|
private |
Definition at line 902 of file ResultSetReduction.cpp.
References TargetInfo::agg_kind, CHECK, QueryMemoryDescriptor::didOutputColumnar(), QueryMemoryDescriptor::getEntryCount(), TargetInfo::is_agg, SQLTypeInfo::is_varlen(), kAVG, kSAMPLE, query_mem_desc_, reduceOneSlot(), and TargetInfo::sql_type.
Referenced by reduceOneEntrySlotsBaseline().
|
private |
Definition at line 1406 of file ResultSetReduction.cpp.
References CHECK, logger::FATAL, result_set::get_width_for_slot(), SQLTypeInfo::is_varlen(), QueryMemoryDescriptor::isLogicalSizedColumnsAllowed(), LOG, query_mem_desc_, reduce(), TargetInfo::sql_type, takes_float_argument(), and target_init_vals_.
Referenced by reduceOneSlot().
|
static |
Definition at line 1638 of file ResultSetReduction.cpp.
References AGGREGATE_ONE_COUNT, AGGREGATE_ONE_NULLABLE_COUNT, AGGREGATE_ONE_NULLABLE_VALUE, AGGREGATE_ONE_NULLABLE_VALUE_SMALL, CHECK, CHECK_EQ, CHECK_GE, count_distinct_set_size(), QueryMemoryDescriptor::didOutputColumnar(), logger::ERROR, get_compact_type(), anonymous_namespace{ResultSetReduction.cpp}::get_component(), QueryMemoryDescriptor::getColOnlyOffInBytes(), QueryMemoryDescriptor::getCountDistinctDescriptor(), QueryMemoryDescriptor::getPaddedSlotWidthBytes(), QueryMemoryDescriptor::getRowSize(), QueryMemoryDescriptor::getSlotCount(), QueryMemoryDescriptor::getTargetIdxForKey(), QueryMemoryDescriptor::hasKeylessHash(), is_distinct_target(), kAPPROX_COUNT_DISTINCT, kAVG, kCOUNT, kCOUNT_IF, kMAX, kMIN, kSAMPLE, kSUM, kSUM_IF, LOG, and takes_float_argument().
Referenced by QueryExecutionContext::groupBufferToDeinterleavedResults().
void ResultSetStorage::rewriteAggregateBufferOffsets | ( | const std::vector< std::string > & | serialized_varlen_buffer | ) | const |
Definition at line 542 of file ResultSetReduction.cpp.
References advance_slot(), advance_target_ptr_row_wise(), align_to_int64(), buff_, CHECK, CHECK_GT, CHECK_LT, QueryMemoryDescriptor::didOutputColumnar(), get_key_bytes_rowwise(), QueryMemoryDescriptor::getEntryCount(), QueryMemoryDescriptor::getPaddedSlotWidthBytes(), isEmptyEntry(), kSAMPLE, query_mem_desc_, row_ptr_rowwise(), and targets_.
|
inline |
Definition at line 128 of file ResultSetStorage.h.
References query_mem_desc_, and QueryMemoryDescriptor::setEntryCount().
|
friend |
Definition at line 250 of file ResultSetStorage.h.
|
friend |
Definition at line 251 of file ResultSetStorage.h.
|
private |
Definition at line 237 of file ResultSetStorage.h.
Referenced by fillOneEntryColWise(), fillOneEntryRowWise(), getUnderlyingBuffer(), initializeColWise(), initializeRowWise(), moveEntriesToBuffer(), reduce(), and rewriteAggregateBufferOffsets().
|
private |
Definition at line 238 of file ResultSetStorage.h.
|
private |
Definition at line 245 of file ResultSetStorage.h.
Referenced by addCountDistinctSetPointerMapping(), and mappedPtr().
|
private |
Definition at line 236 of file ResultSetStorage.h.
Referenced by copyKeyColWise(), fillOneEntryColWise(), fillOneEntryRowWise(), getEntryCount(), initializeBaselineValueSlots(), initializeColWise(), initializeRowWise(), moveEntriesToBuffer(), moveOneEntryToBuffer(), reduce(), reduceEntriesNoCollisionsColWise(), reduceOneApproxQuantileSlot(), reduceOneCountDistinctSlot(), reduceOneEntryBaseline(), reduceOneEntrySlotsBaseline(), reduceOneSlot(), reduceOneSlotBaseline(), reduceOneSlotSingleValue(), rewriteAggregateBufferOffsets(), and updateEntryCount().
|
private |
Definition at line 239 of file ResultSetStorage.h.
Referenced by fillOneEntryColWise(), fillOneEntryRowWise(), initializeBaselineValueSlots(), initializeColWise(), initializeRowWise(), reduceOneSlot(), and reduceOneSlotSingleValue().
|
private |
Definition at line 235 of file ResultSetStorage.h.
Referenced by reduceEntriesNoCollisionsColWise(), reduceOneEntrySlotsBaseline(), and rewriteAggregateBufferOffsets().
|
private |
Definition at line 248 of file ResultSetStorage.h.
Referenced by getVarlenOutputInfo().