OmniSciDB
085a039ca4
|
#include <ResultSet.h>
Classes | |
struct | ColumnWiseTargetAccessor |
struct | QueryExecutionTimings |
struct | ResultSetComparator |
struct | RowIterationState |
struct | RowWiseTargetAccessor |
struct | StorageLookupResult |
struct | TargetOffsets |
struct | VarlenTargetPtrPair |
Public Types | |
enum | GeoReturnType { GeoReturnType::GeoTargetValue, GeoReturnType::WktString, GeoReturnType::GeoTargetValuePtr, GeoReturnType::GeoTargetValueGpuPtr } |
Public Member Functions | |
ResultSet (const std::vector< TargetInfo > &targets, const ExecutorDeviceType device_type, const QueryMemoryDescriptor &query_mem_desc, const std::shared_ptr< RowSetMemoryOwner > row_set_mem_owner, const Catalog_Namespace::Catalog *catalog, const unsigned block_size, const unsigned grid_size) | |
ResultSet (const std::vector< TargetInfo > &targets, const std::vector< ColumnLazyFetchInfo > &lazy_fetch_info, const std::vector< std::vector< const int8_t * >> &col_buffers, const std::vector< std::vector< int64_t >> &frag_offsets, const std::vector< int64_t > &consistent_frag_sizes, const ExecutorDeviceType device_type, const int device_id, const QueryMemoryDescriptor &query_mem_desc, const std::shared_ptr< RowSetMemoryOwner > row_set_mem_owner, const Catalog_Namespace::Catalog *catalog, const unsigned block_size, const unsigned grid_size) | |
ResultSet (const std::shared_ptr< const Analyzer::Estimator >, const ExecutorDeviceType device_type, const int device_id, Data_Namespace::DataMgr *data_mgr) | |
ResultSet (const std::string &explanation) | |
ResultSet (int64_t queue_time_ms, int64_t render_time_ms, const std::shared_ptr< RowSetMemoryOwner > row_set_mem_owner) | |
~ResultSet () | |
std::string | toString () const |
std::string | summaryToString () const |
ResultSetRowIterator | rowIterator (size_t from_logical_index, bool translate_strings, bool decimal_to_double) const |
ResultSetRowIterator | rowIterator (bool translate_strings, bool decimal_to_double) const |
ExecutorDeviceType | getDeviceType () const |
const ResultSetStorage * | allocateStorage () const |
const ResultSetStorage * | allocateStorage (int8_t *, const std::vector< int64_t > &, std::shared_ptr< VarlenOutputInfo >=nullptr) const |
const ResultSetStorage * | allocateStorage (const std::vector< int64_t > &) const |
void | updateStorageEntryCount (const size_t new_entry_count) |
std::vector< TargetValue > | getNextRow (const bool translate_strings, const bool decimal_to_double) const |
size_t | getCurrentRowBufferIndex () const |
std::vector< TargetValue > | getRowAt (const size_t index) const |
TargetValue | getRowAt (const size_t row_idx, const size_t col_idx, const bool translate_strings, const bool decimal_to_double=true) const |
OneIntegerColumnRow | getOneColRow (const size_t index) const |
std::vector< TargetValue > | getRowAtNoTranslations (const size_t index, const std::vector< bool > &targets_to_skip={}) const |
bool | isRowAtEmpty (const size_t index) const |
void | sort (const std::list< Analyzer::OrderEntry > &order_entries, size_t top_n, const Executor *executor) |
void | keepFirstN (const size_t n) |
void | dropFirstN (const size_t n) |
void | append (ResultSet &that) |
const ResultSetStorage * | getStorage () const |
size_t | colCount () const |
SQLTypeInfo | getColType (const size_t col_idx) const |
size_t | rowCount (const bool force_parallel=false) const |
Returns the number of valid entries in the result set (i.e that will be returned from the SQL query or inputted into the next query step) More... | |
void | invalidateCachedRowCount () const |
void | setCachedRowCount (const size_t row_count) const |
bool | isEmpty () const |
Returns a boolean signifying whether there are valid entries in the result set. More... | |
size_t | entryCount () const |
Returns the number of entries the result set is allocated to hold. More... | |
size_t | getBufferSizeBytes (const ExecutorDeviceType device_type) const |
bool | definitelyHasNoRows () const |
const QueryMemoryDescriptor & | getQueryMemDesc () const |
const std::vector< TargetInfo > & | getTargetInfos () const |
const std::vector< int64_t > & | getTargetInitVals () const |
int8_t * | getDeviceEstimatorBuffer () const |
int8_t * | getHostEstimatorBuffer () const |
void | syncEstimatorBuffer () const |
size_t | getNDVEstimator () const |
void | setQueueTime (const int64_t queue_time) |
void | setKernelQueueTime (const int64_t kernel_queue_time) |
void | addCompilationQueueTime (const int64_t compilation_queue_time) |
int64_t | getQueueTime () const |
int64_t | getRenderTime () const |
void | moveToBegin () const |
bool | isTruncated () const |
bool | isExplain () const |
void | setValidationOnlyRes () |
bool | isValidationOnlyRes () const |
std::string | getExplanation () const |
bool | isGeoColOnGpu (const size_t col_idx) const |
int | getDeviceId () const |
void | fillOneEntry (const std::vector< int64_t > &entry) |
void | initializeStorage () const |
void | holdChunks (const std::list< std::shared_ptr< Chunk_NS::Chunk >> &chunks) |
void | holdChunkIterators (const std::shared_ptr< std::list< ChunkIter >> chunk_iters) |
void | holdLiterals (std::vector< int8_t > &literal_buff) |
std::shared_ptr < RowSetMemoryOwner > | getRowSetMemOwner () const |
const Permutation & | getPermutationBuffer () const |
const bool | isPermutationBufferEmpty () const |
void | serialize (TSerializedRows &serialized_rows) const |
size_t | getLimit () const |
ResultSetPtr | copy () |
void | clearPermutation () |
void | initStatus () |
void | invalidateResultSetChunks () |
const bool | isEstimator () const |
void | setCached (bool val) |
const bool | isCached () const |
void | setExecTime (const long exec_time) |
const long | getExecTime () const |
void | setQueryPlanHash (const QueryPlanHash query_plan) |
const QueryPlanHash | getQueryPlanHash () |
std::unordered_set< size_t > | getInputTableKeys () const |
void | setInputTableKeys (std::unordered_set< size_t > &&intput_table_keys) |
void | setTargetMetaInfo (const std::vector< TargetMetaInfo > &target_meta_info) |
std::vector< TargetMetaInfo > | getTargetMetaInfo () |
std::optional< bool > | canUseSpeculativeTopNSort () const |
void | setUseSpeculativeTopNSort (bool value) |
const bool | hasValidBuffer () const |
GeoReturnType | getGeoReturnType () const |
void | setGeoReturnType (const GeoReturnType val) |
void | copyColumnIntoBuffer (const size_t column_idx, int8_t *output_buffer, const size_t output_buffer_size) const |
bool | isDirectColumnarConversionPossible () const |
bool | didOutputColumnar () const |
bool | isZeroCopyColumnarConversionPossible (size_t column_idx) const |
const int8_t * | getColumnarBuffer (size_t column_idx) const |
QueryDescriptionType | getQueryDescriptionType () const |
const int8_t | getPaddedSlotWidthBytes (const size_t slot_idx) const |
std::tuple< std::vector< bool > , size_t > | getSingleSlotTargetBitmap () const |
std::tuple< std::vector< bool > , size_t > | getSupportedSingleSlotTargetBitmap () const |
std::vector< size_t > | getSlotIndicesForTargetIndices () const |
const std::vector < ColumnLazyFetchInfo > & | getLazyFetchInfo () const |
bool | areAnyColumnsLazyFetched () const |
size_t | getNumColumnsLazyFetched () const |
void | setSeparateVarlenStorageValid (const bool val) |
const std::vector< std::string > | getStringDictionaryPayloadCopy (const int dict_id) const |
const std::pair< std::vector < int32_t >, std::vector < std::string > > | getUniqueStringsForDictEncodedTargetCol (const size_t col_idx) const |
StringDictionaryProxy * | getStringDictionaryProxy (int const dict_id) const |
template<typename ENTRY_TYPE , QueryDescriptionType QUERY_TYPE, bool COLUMNAR_FORMAT> | |
ENTRY_TYPE | getEntryAt (const size_t row_idx, const size_t target_idx, const size_t slot_idx) const |
ChunkStats | getTableFunctionChunkStats (const size_t target_idx) const |
void | translateDictEncodedColumns (std::vector< TargetInfo > const &, size_t const start_idx) |
void | eachCellInColumn (RowIterationState &, CellCallback const &) |
const Executor * | getExecutor () const |
template<typename ENTRY_TYPE , QueryDescriptionType QUERY_TYPE, bool COLUMNAR_FORMAT> | |
ENTRY_TYPE | getEntryAt (const size_t row_idx, const size_t target_idx, const size_t slot_idx) const |
template<typename ENTRY_TYPE > | |
ENTRY_TYPE | getColumnarPerfectHashEntryAt (const size_t row_idx, const size_t target_idx, const size_t slot_idx) const |
template<typename ENTRY_TYPE > | |
ENTRY_TYPE | getRowWisePerfectHashEntryAt (const size_t row_idx, const size_t target_idx, const size_t slot_idx) const |
template<typename ENTRY_TYPE > | |
ENTRY_TYPE | getRowWiseBaselineEntryAt (const size_t row_idx, const size_t target_idx, const size_t slot_idx) const |
template<typename ENTRY_TYPE > | |
ENTRY_TYPE | getColumnarBaselineEntryAt (const size_t row_idx, const size_t target_idx, const size_t slot_idx) const |
Static Public Member Functions | |
static QueryMemoryDescriptor | fixupQueryMemoryDescriptor (const QueryMemoryDescriptor &) |
static std::unique_ptr< ResultSet > | unserialize (const TSerializedRows &serialized_rows, const Executor *) |
static double | calculateQuantile (quantile::TDigest *const t_digest) |
Public Attributes | |
friend | ResultSetBuilder |
Private Types | |
using | ApproxQuantileBuffers = std::vector< std::vector< double >> |
using | SerializedVarlenBufferStorage = std::vector< std::string > |
Private Member Functions | |
void | advanceCursorToNextEntry (ResultSetRowIterator &iter) const |
std::vector< TargetValue > | getNextRowImpl (const bool translate_strings, const bool decimal_to_double) const |
std::vector< TargetValue > | getNextRowUnlocked (const bool translate_strings, const bool decimal_to_double) const |
std::vector< TargetValue > | getRowAt (const size_t index, const bool translate_strings, const bool decimal_to_double, const bool fixup_count_distinct_pointers, const std::vector< bool > &targets_to_skip={}) const |
template<typename ENTRY_TYPE > | |
ENTRY_TYPE | getColumnarPerfectHashEntryAt (const size_t row_idx, const size_t target_idx, const size_t slot_idx) const |
template<typename ENTRY_TYPE > | |
ENTRY_TYPE | getRowWisePerfectHashEntryAt (const size_t row_idx, const size_t target_idx, const size_t slot_idx) const |
template<typename ENTRY_TYPE > | |
ENTRY_TYPE | getRowWiseBaselineEntryAt (const size_t row_idx, const size_t target_idx, const size_t slot_idx) const |
template<typename ENTRY_TYPE > | |
ENTRY_TYPE | getColumnarBaselineEntryAt (const size_t row_idx, const size_t target_idx, const size_t slot_idx) const |
size_t | binSearchRowCount () const |
size_t | parallelRowCount () const |
size_t | advanceCursorToNextEntry () const |
void | radixSortOnGpu (const std::list< Analyzer::OrderEntry > &order_entries) const |
void | radixSortOnCpu (const std::list< Analyzer::OrderEntry > &order_entries) const |
TargetValue | getTargetValueFromBufferRowwise (int8_t *rowwise_target_ptr, int8_t *keys_ptr, const size_t entry_buff_idx, const TargetInfo &target_info, const size_t target_logical_idx, const size_t slot_idx, const bool translate_strings, const bool decimal_to_double, const bool fixup_count_distinct_pointers) const |
TargetValue | getTargetValueFromBufferColwise (const int8_t *col_ptr, const int8_t *keys_ptr, const QueryMemoryDescriptor &query_mem_desc, const size_t local_entry_idx, const size_t global_entry_idx, const TargetInfo &target_info, const size_t target_logical_idx, const size_t slot_idx, const bool translate_strings, const bool decimal_to_double) const |
TargetValue | makeTargetValue (const int8_t *ptr, const int8_t compact_sz, const TargetInfo &target_info, const size_t target_logical_idx, const bool translate_strings, const bool decimal_to_double, const size_t entry_buff_idx) const |
TargetValue | makeVarlenTargetValue (const int8_t *ptr1, const int8_t compact_sz1, const int8_t *ptr2, const int8_t compact_sz2, const TargetInfo &target_info, const size_t target_logical_idx, const bool translate_strings, const size_t entry_buff_idx) const |
TargetValue | makeGeoTargetValue (const int8_t *geo_target_ptr, const size_t slot_idx, const TargetInfo &target_info, const size_t target_logical_idx, const size_t entry_buff_idx) const |
InternalTargetValue | getVarlenOrderEntry (const int64_t str_ptr, const size_t str_len) const |
int64_t | lazyReadInt (const int64_t ival, const size_t target_logical_idx, const StorageLookupResult &storage_lookup_result) const |
std::pair< size_t, size_t > | getStorageIndex (const size_t entry_idx) const |
const std::vector< const int8_t * > & | getColumnFrag (const size_t storge_idx, const size_t col_logical_idx, int64_t &global_idx) const |
const VarlenOutputInfo * | getVarlenOutputInfo (const size_t entry_idx) const |
StorageLookupResult | findStorage (const size_t entry_idx) const |
Comparator | createComparator (const std::list< Analyzer::OrderEntry > &order_entries, const PermutationView permutation, const Executor *executor, const bool single_threaded) |
PermutationView | initPermutationBuffer (PermutationView permutation, PermutationIdx const begin, PermutationIdx const end) const |
void | parallelTop (const std::list< Analyzer::OrderEntry > &order_entries, const size_t top_n, const Executor *executor) |
void | baselineSort (const std::list< Analyzer::OrderEntry > &order_entries, const size_t top_n, const Executor *executor) |
void | doBaselineSort (const ExecutorDeviceType device_type, const std::list< Analyzer::OrderEntry > &order_entries, const size_t top_n, const Executor *executor) |
bool | canUseFastBaselineSort (const std::list< Analyzer::OrderEntry > &order_entries, const size_t top_n) |
size_t | rowCountImpl (const bool force_parallel) const |
Data_Namespace::DataMgr * | getDataManager () const |
int | getGpuCount () const |
void | serializeProjection (TSerializedRows &serialized_rows) const |
void | serializeVarlenAggColumn (int8_t *buf, std::vector< std::string > &varlen_bufer) const |
void | serializeCountDistinctColumns (TSerializedRows &) const |
void | unserializeCountDistinctColumns (const TSerializedRows &) |
void | fixupCountDistinctPointers () |
void | create_active_buffer_set (CountDistinctSet &count_distinct_active_buffer_set) const |
int64_t | getDistinctBufferRefFromBufferRowwise (int8_t *rowwise_target_ptr, const TargetInfo &target_info) const |
Static Private Member Functions | |
static bool | isNull (const SQLTypeInfo &ti, const InternalTargetValue &val, const bool float_argument_input) |
static PermutationView | topPermutation (PermutationView, const size_t n, const Comparator &) |
Friends | |
class | ResultSetManager |
class | ResultSetRowIterator |
class | ColumnarResults |
Definition at line 159 of file ResultSet.h.
|
private |
Definition at line 795 of file ResultSet.h.
|
private |
Definition at line 935 of file ResultSet.h.
|
strong |
Geo return type options when accessing geo columns from a result set.
Definition at line 519 of file ResultSet.h.
ResultSet::ResultSet | ( | const std::vector< TargetInfo > & | targets, |
const ExecutorDeviceType | device_type, | ||
const QueryMemoryDescriptor & | query_mem_desc, | ||
const std::shared_ptr< RowSetMemoryOwner > | row_set_mem_owner, | ||
const Catalog_Namespace::Catalog * | catalog, | ||
const unsigned | block_size, | ||
const unsigned | grid_size | ||
) |
Definition at line 62 of file ResultSet.cpp.
ResultSet::ResultSet | ( | const std::vector< TargetInfo > & | targets, |
const std::vector< ColumnLazyFetchInfo > & | lazy_fetch_info, | ||
const std::vector< std::vector< const int8_t * >> & | col_buffers, | ||
const std::vector< std::vector< int64_t >> & | frag_offsets, | ||
const std::vector< int64_t > & | consistent_frag_sizes, | ||
const ExecutorDeviceType | device_type, | ||
const int | device_id, | ||
const QueryMemoryDescriptor & | query_mem_desc, | ||
const std::shared_ptr< RowSetMemoryOwner > | row_set_mem_owner, | ||
const Catalog_Namespace::Catalog * | catalog, | ||
const unsigned | block_size, | ||
const unsigned | grid_size | ||
) |
Definition at line 92 of file ResultSet.cpp.
ResultSet::ResultSet | ( | const std::shared_ptr< const Analyzer::Estimator > | , |
const ExecutorDeviceType | device_type, | ||
const int | device_id, | ||
Data_Namespace::DataMgr * | data_mgr | ||
) |
ResultSet::ResultSet | ( | const std::string & | explanation | ) |
Definition at line 163 of file ResultSet.cpp.
References CPU.
ResultSet::ResultSet | ( | int64_t | queue_time_ms, |
int64_t | render_time_ms, | ||
const std::shared_ptr< RowSetMemoryOwner > | row_set_mem_owner | ||
) |
Definition at line 178 of file ResultSet.cpp.
References CPU.
ResultSet::~ResultSet | ( | ) |
Definition at line 196 of file ResultSet.cpp.
References CHECK, CPU, and data_mgr_().
void ResultSet::addCompilationQueueTime | ( | const int64_t | compilation_queue_time | ) |
Definition at line 718 of file ResultSet.cpp.
|
private |
|
private |
const ResultSetStorage* ResultSet::allocateStorage | ( | ) | const |
const ResultSetStorage* ResultSet::allocateStorage | ( | int8_t * | , |
const std::vector< int64_t > & | , | ||
std::shared_ptr< VarlenOutputInfo > | = nullptr |
||
) | const |
const ResultSetStorage* ResultSet::allocateStorage | ( | const std::vector< int64_t > & | ) | const |
void ResultSet::append | ( | ResultSet & | that | ) |
Definition at line 299 of file ResultSet.cpp.
References CHECK.
|
inline |
Definition at line 561 of file ResultSet.h.
References lazy_fetch_info_.
|
private |
|
private |
Definition at line 616 of file ResultSet.cpp.
References anonymous_namespace{ResultSet.cpp}::get_truncated_row_count().
|
static |
Definition at line 1008 of file ResultSet.cpp.
References CHECK, quantile::detail::TDigest< RealType, IndexType >::mergeBufferFinal(), NULL_DOUBLE, and quantile::detail::TDigest< RealType, IndexType >::quantile().
Referenced by makeTargetValue().
|
private |
|
inline |
Definition at line 503 of file ResultSet.h.
References can_use_speculative_top_n_sort.
|
inline |
Definition at line 448 of file ResultSet.h.
References permutation_.
Referenced by initStatus().
size_t ResultSet::colCount | ( | ) | const |
Definition at line 413 of file ResultSet.cpp.
ResultSetPtr ResultSet::copy | ( | ) |
Definition at line 329 of file ResultSet.cpp.
References CHECK, gpu_enabled::copy(), and DEBUG_TIMER.
void ResultSet::copyColumnIntoBuffer | ( | const size_t | column_idx, |
int8_t * | output_buffer, | ||
const size_t | output_buffer_size | ||
) | const |
For each specified column, this function goes through all available storages and copies its content into a contiguous output_buffer
Definition at line 1123 of file ResultSetIteration.cpp.
References appended_storage_, CHECK, CHECK_LT, QueryMemoryDescriptor::getPaddedSlotWidthBytes(), QueryMemoryDescriptor::getSlotCount(), isDirectColumnarConversionPossible(), query_mem_desc_, and storage_.
|
private |
|
inlineprivate |
Definition at line 836 of file ResultSet.h.
References DEBUG_TIMER, QueryMemoryDescriptor::didOutputColumnar(), and query_mem_desc_.
bool ResultSet::definitelyHasNoRows | ( | ) | const |
Definition at line 668 of file ResultSet.cpp.
|
inline |
Definition at line 537 of file ResultSet.h.
References QueryMemoryDescriptor::didOutputColumnar(), and query_mem_desc_.
|
private |
void ResultSet::dropFirstN | ( | const size_t | n | ) |
Definition at line 57 of file ResultSet.cpp.
References anonymous_namespace{Utm.h}::n.
void ResultSet::eachCellInColumn | ( | RowIterationState & | state, |
CellCallback const & | func | ||
) |
Definition at line 485 of file ResultSet.cpp.
References advance_slot(), advance_to_next_columnar_target_buff(), ResultSet::RowIterationState::agg_idx_, align_to_int64(), ResultSet::RowIterationState::buf_ptr_, CHECK, CHECK_GE, CHECK_LT, ResultSet::RowIterationState::compact_sz1_, ResultSet::RowIterationState::cur_target_idx_, QueryMemoryDescriptor::didOutputColumnar(), get_cols_ptr(), get_key_bytes_rowwise(), QueryMemoryDescriptor::getPaddedSlotWidthBytes(), ResultSet::RowIterationState::prev_target_idx_, read_int_from_buff(), and row_ptr_rowwise().
size_t ResultSet::entryCount | ( | ) | const |
Returns the number of entries the result set is allocated to hold.
Note that this can be greater than or equal to the actual number of valid rows in the result set, whether due to a SQL LIMIT/OFFSET applied or because the result set representation is inherently sparse (i.e. baseline hash group by)
For getting the number of valid rows in the result set (inclusive of any applied LIMIT and/or OFFSET), use ResultSet::rowCount().
Or to just test if there are any valid rows, use ResultSet::entryCount()
, as a return value from entryCount()
greater than 0 does not neccesarily mean the result set is empty.
Definition at line 752 of file ResultSetIteration.cpp.
References QueryMemoryDescriptor::getEntryCount(), permutation_, and query_mem_desc_.
|
inline |
|
private |
Definition at line 939 of file ResultSet.cpp.
Referenced by getVarlenOutputInfo(), and makeGeoTargetValue().
|
private |
|
static |
Definition at line 756 of file ResultSet.cpp.
References QueryMemoryDescriptor::didOutputColumnar(), and query_mem_desc.
Referenced by GpuSharedMemCodeBuilder::codegenInitialization(), GpuSharedMemCodeBuilder::codegenReduction(), Executor::executeTableFunction(), QueryExecutionContext::groupBufferToDeinterleavedResults(), QueryMemoryInitializer::initRowGroups(), QueryMemoryInitializer::QueryMemoryInitializer(), and Executor::reduceMultiDeviceResults().
size_t ResultSet::getBufferSizeBytes | ( | const ExecutorDeviceType | device_type | ) | const |
SQLTypeInfo ResultSet::getColType | ( | const size_t | col_idx | ) | const |
Definition at line 417 of file ResultSet.cpp.
References CHECK_LT, kAVG, kDOUBLE, and kTEXT.
|
private |
ENTRY_TYPE ResultSet::getColumnarBaselineEntryAt | ( | const size_t | row_idx, |
const size_t | target_idx, | ||
const size_t | slot_idx | ||
) | const |
Directly accesses the result set's storage buffer for a particular data type (row-wise output, baseline hash group by)
NOTE: Currently, only used in direct columnarization
Definition at line 1295 of file ResultSetIteration.cpp.
References CHECK_NE, and storage_.
const int8_t * ResultSet::getColumnarBuffer | ( | size_t | column_idx | ) | const |
Definition at line 1388 of file ResultSet.cpp.
References CHECK.
|
private |
ENTRY_TYPE ResultSet::getColumnarPerfectHashEntryAt | ( | const size_t | row_idx, |
const size_t | target_idx, | ||
const size_t | slot_idx | ||
) | const |
Directly accesses the result set's storage buffer for a particular data type (columnar output, perfect hash group by)
NOTE: Currently, only used in direct columnarization
Definition at line 1241 of file ResultSetIteration.cpp.
References storage_.
|
private |
Definition at line 1088 of file ResultSetIteration.cpp.
References CHECK_EQ, CHECK_GE, CHECK_LE, CHECK_LT, col_buffers_, consistent_frag_sizes_, frag_offsets_, and anonymous_namespace{ResultSetIteration.cpp}::get_frag_id_and_local_idx().
Referenced by lazyReadInt(), makeGeoTargetValue(), makeTargetValue(), and makeVarlenTargetValue().
size_t ResultSet::getCurrentRowBufferIndex | ( | ) | const |
Definition at line 291 of file ResultSet.cpp.
|
private |
int8_t * ResultSet::getDeviceEstimatorBuffer | ( | ) | const |
Definition at line 686 of file ResultSet.cpp.
int ResultSet::getDeviceId | ( | ) | const |
Definition at line 752 of file ResultSet.cpp.
ExecutorDeviceType ResultSet::getDeviceType | ( | ) | const |
Definition at line 250 of file ResultSet.cpp.
|
private |
ENTRY_TYPE ResultSet::getEntryAt | ( | const size_t | row_idx, |
const size_t | target_idx, | ||
const size_t | slot_idx | ||
) | const |
ENTRY_TYPE ResultSet::getEntryAt | ( | const size_t | row_idx, |
const size_t | target_idx, | ||
const size_t | slot_idx | ||
) | const |
Definition at line 1165 of file ResultSetIteration.cpp.
References GroupByBaselineHash, GroupByPerfectHash, and UNREACHABLE.
|
inline |
|
inline |
Definition at line 605 of file ResultSet.h.
References QueryMemoryDescriptor::getExecutor(), and query_mem_desc_.
|
inline |
|
inline |
|
private |
int8_t * ResultSet::getHostEstimatorBuffer | ( | ) | const |
Definition at line 692 of file ResultSet.cpp.
|
inline |
Definition at line 489 of file ResultSet.h.
References input_table_keys_.
|
inline |
Definition at line 557 of file ResultSet.h.
References lazy_fetch_info_.
size_t ResultSet::getLimit | ( | ) | const |
Definition at line 1302 of file ResultSet.cpp.
size_t ResultSet::getNDVEstimator | ( | ) | const |
Definition at line 33 of file CardinalityEstimator.cpp.
References bitmap_set_size(), CHECK, CHECK_LE, LOG, and logger::WARNING.
std::vector< TargetValue > ResultSet::getNextRow | ( | const bool | translate_strings, |
const bool | decimal_to_double | ||
) | const |
Definition at line 298 of file ResultSetIteration.cpp.
|
private |
Definition at line 320 of file ResultSetIteration.cpp.
References CHECK, and CHECK_EQ.
|
private |
Definition at line 307 of file ResultSetIteration.cpp.
|
inline |
Definition at line 566 of file ResultSet.h.
References lazy_fetch_info_.
OneIntegerColumnRow ResultSet::getOneColRow | ( | const size_t | index | ) | const |
Definition at line 236 of file ResultSetIteration.cpp.
References align_to_int64(), CHECK, get_key_bytes_rowwise(), and row_ptr_rowwise().
|
inline |
Definition at line 546 of file ResultSet.h.
References QueryMemoryDescriptor::getPaddedSlotWidthBytes(), and query_mem_desc_.
const Permutation & ResultSet::getPermutationBuffer | ( | ) | const |
Definition at line 862 of file ResultSet.cpp.
|
inline |
Definition at line 542 of file ResultSet.h.
References QueryMemoryDescriptor::getQueryDescriptionType(), and query_mem_desc_.
const QueryMemoryDescriptor & ResultSet::getQueryMemDesc | ( | ) | const |
|
inline |
int64_t ResultSet::getQueueTime | ( | ) | const |
Definition at line 722 of file ResultSet.cpp.
int64_t ResultSet::getRenderTime | ( | ) | const |
Definition at line 727 of file ResultSet.cpp.
std::vector<TargetValue> ResultSet::getRowAt | ( | const size_t | index | ) | const |
TargetValue ResultSet::getRowAt | ( | const size_t | row_idx, |
const size_t | col_idx, | ||
const bool | translate_strings, | ||
const bool | decimal_to_double = true |
||
) | const |
|
private |
std::vector< TargetValue > ResultSet::getRowAtNoTranslations | ( | const size_t | index, |
const std::vector< bool > & | targets_to_skip = {} |
||
) | const |
Definition at line 275 of file ResultSetIteration.cpp.
|
inline |
Definition at line 431 of file ResultSet.h.
References row_set_mem_owner_.
|
private |
ENTRY_TYPE ResultSet::getRowWiseBaselineEntryAt | ( | const size_t | row_idx, |
const size_t | target_idx, | ||
const size_t | slot_idx | ||
) | const |
Directly accesses the result set's storage buffer for a particular data type (columnar output, baseline hash group by)
NOTE: Currently, only used in direct columnarization
Definition at line 1273 of file ResultSetIteration.cpp.
References CHECK_NE, row_ptr_rowwise(), and storage_.
|
private |
ENTRY_TYPE ResultSet::getRowWisePerfectHashEntryAt | ( | const size_t | row_idx, |
const size_t | target_idx, | ||
const size_t | slot_idx | ||
) | const |
Directly accesses the result set's storage buffer for a particular data type (row-wise output, perfect hash group by)
NOTE: Currently, only used in direct columnarization
Definition at line 1256 of file ResultSetIteration.cpp.
References storage_.
std::tuple< std::vector< bool >, size_t > ResultSet::getSingleSlotTargetBitmap | ( | ) | const |
Definition at line 1394 of file ResultSet.cpp.
References anonymous_namespace{RelAlgExecutor.cpp}::is_agg(), and kAVG.
std::vector< size_t > ResultSet::getSlotIndicesForTargetIndices | ( | ) | const |
Definition at line 1437 of file ResultSet.cpp.
References advance_slot().
const ResultSetStorage * ResultSet::getStorage | ( | ) | const |
Definition at line 409 of file ResultSet.cpp.
|
private |
Returns (storageIdx, entryIdx) pair, where: storageIdx : 0 is storage_, storageIdx-1 is index into appended_storage_. entryIdx : local index into the storage object.
Definition at line 914 of file ResultSet.cpp.
References CHECK_NE, and UNREACHABLE.
Referenced by makeGeoTargetValue(), makeTargetValue(), and makeVarlenTargetValue().
const std::vector< std::string > ResultSet::getStringDictionaryPayloadCopy | ( | const int | dict_id | ) | const |
Definition at line 1306 of file ResultSet.cpp.
References catalog_(), and CHECK.
StringDictionaryProxy * ResultSet::getStringDictionaryProxy | ( | int const | dict_id | ) | const |
Definition at line 426 of file ResultSet.cpp.
References catalog_().
std::tuple< std::vector< bool >, size_t > ResultSet::getSupportedSingleSlotTargetBitmap | ( | ) | const |
This function returns a bitmap and population count of it, where it denotes all supported single-column targets suitable for direct columnarization.
The final goal is to remove the need for such selection, but at the moment for any target that doesn't qualify for direct columnarization, we use the traditional result set's iteration to handle it (e.g., count distinct, approximate count distinct)
Definition at line 1418 of file ResultSet.cpp.
References CHECK, CHECK_GE, is_distinct_target(), kAPPROX_QUANTILE, kFLOAT, and kSAMPLE.
ChunkStats ResultSet::getTableFunctionChunkStats | ( | const size_t | target_idx | ) | const |
const std::vector< TargetInfo > & ResultSet::getTargetInfos | ( | ) | const |
Definition at line 677 of file ResultSet.cpp.
const std::vector< int64_t > & ResultSet::getTargetInitVals | ( | ) | const |
|
inline |
Definition at line 501 of file ResultSet.h.
References target_meta_info_.
|
private |
Definition at line 1887 of file ResultSetIteration.cpp.
References advance_to_next_columnar_target_buff(), TargetInfo::agg_kind, CHECK, CHECK_GE, anonymous_namespace{ResultSetIteration.cpp}::columnar_elem_ptr(), QueryMemoryDescriptor::didOutputColumnar(), QueryMemoryDescriptor::getEffectiveKeyWidth(), QueryMemoryDescriptor::getEntryCount(), QueryMemoryDescriptor::getPaddedSlotWidthBytes(), QueryMemoryDescriptor::getTargetGroupbyIndex(), TargetInfo::is_agg, SQLTypeInfo::is_geometry(), is_real_str_or_array(), kAVG, anonymous_namespace{ResultSetIteration.cpp}::make_avg_target_value(), makeGeoTargetValue(), makeTargetValue(), makeVarlenTargetValue(), query_mem_desc_, TargetInfo::sql_type, and QueryMemoryDescriptor::targetGroupbyIndicesSize().
|
private |
Definition at line 1960 of file ResultSetIteration.cpp.
References TargetInfo::agg_kind, CHECK, QueryMemoryDescriptor::count_distinct_descriptors_, SQLTypeInfo::get_compression(), QueryMemoryDescriptor::getEffectiveKeyWidth(), QueryMemoryDescriptor::getLogicalSlotWidthBytes(), QueryMemoryDescriptor::getPaddedSlotWidthBytes(), QueryMemoryDescriptor::getTargetGroupbyIndex(), QueryMemoryDescriptor::hasKeylessHash(), TargetInfo::is_agg, SQLTypeInfo::is_array(), is_distinct_target(), SQLTypeInfo::is_geometry(), is_real_str_or_array(), SQLTypeInfo::is_string(), QueryMemoryDescriptor::isSingleColumnGroupByWithPerfectHash(), kAVG, kENCODING_NONE, anonymous_namespace{ResultSetIteration.cpp}::make_avg_target_value(), makeGeoTargetValue(), makeTargetValue(), makeVarlenTargetValue(), query_mem_desc_, row_set_mem_owner_, separate_varlen_storage_valid_, TargetInfo::sql_type, storage_, QueryMemoryDescriptor::targetGroupbyIndicesSize(), and UNLIKELY.
const std::pair< std::vector< int32_t >, std::vector< std::string > > ResultSet::getUniqueStringsForDictEncodedTargetCol | ( | const size_t | col_idx | ) | const |
Definition at line 1315 of file ResultSet.cpp.
References catalog_(), CHECK, and inline_fixed_encoding_null_val().
|
private |
Definition at line 627 of file ResultSetIteration.cpp.
References CHECK, CPU, device_id_, device_type_, QueryMemoryDescriptor::getExecutor(), getQueryEngineCudaStreamForDevice(), GPU, query_mem_desc_, and row_set_mem_owner_.
|
private |
Definition at line 1113 of file ResultSetIteration.cpp.
References CHECK, and findStorage().
Referenced by makeGeoTargetValue().
|
inline |
|
inline |
Definition at line 424 of file ResultSet.h.
References chunk_iters_.
|
inline |
Definition at line 421 of file ResultSet.h.
References chunks_.
|
inline |
Definition at line 427 of file ResultSet.h.
References literal_buffers_.
void ResultSet::initializeStorage | ( | ) | const |
Definition at line 1045 of file ResultSetReduction.cpp.
|
private |
Definition at line 846 of file ResultSet.cpp.
References CHECK, DEBUG_TIMER, and VectorView< T >::push_back().
|
inline |
Definition at line 454 of file ResultSet.h.
References clearPermutation(), crt_row_buff_idx_, drop_first_, fetched_so_far_, invalidateCachedRowCount(), keep_first_, setGeoReturnType(), and WktString.
void ResultSet::invalidateCachedRowCount | ( | ) | const |
Definition at line 605 of file ResultSet.cpp.
References uninitialized_cached_row_count.
Referenced by initStatus().
|
inline |
Definition at line 466 of file ResultSet.h.
References chunk_iters_, and chunks_.
|
inline |
bool ResultSet::isDirectColumnarConversionPossible | ( | ) | const |
Determines if it is possible to directly form a ColumnarResults class from this result set, bypassing the default columnarization.
NOTE: If there exists a permutation vector (i.e., in some ORDER BY queries), it becomes equivalent to the row-wise columnarization.
Definition at line 1357 of file ResultSet.cpp.
References CHECK, g_enable_direct_columnarization, GroupByBaselineHash, GroupByPerfectHash, Projection, and TableFunction.
Referenced by copyColumnIntoBuffer().
bool ResultSet::isEmpty | ( | ) | const |
Returns a boolean signifying whether there are valid entries in the result set.
Note a result set can be logically empty even if the value returned by ResultSet::entryCount()
is > 0, whether due to a SQL LIMIT/OFFSET applied or because the result set representation is inherently sparse (i.e. baseline hash group by).
Internally this function is just implemented as ResultSet::rowCount() == 0
, which caches it's value so the row count will only be computed once per finalized result set.
Definition at line 649 of file ResultSet.cpp.
|
inline |
Definition at line 475 of file ResultSet.h.
References estimator_.
bool ResultSet::isExplain | ( | ) | const |
Definition at line 740 of file ResultSet.cpp.
bool ResultSet::isGeoColOnGpu | ( | const size_t | col_idx | ) | const |
Definition at line 1436 of file ResultSetIteration.cpp.
References CHECK_LT, device_type_, GPU, IS_GEO, lazy_fetch_info_, separate_varlen_storage_valid_, targets_, and to_string().
|
staticprivate |
Definition at line 2203 of file ResultSetIteration.cpp.
References CHECK, SQLTypeInfo::get_notnull(), InternalTargetValue::i1, InternalTargetValue::i2, InternalTargetValue::isInt(), InternalTargetValue::isNull(), InternalTargetValue::isPair(), InternalTargetValue::isStr(), and null_val_bit_pattern().
|
inline |
bool ResultSet::isRowAtEmpty | ( | const size_t | index | ) | const |
Definition at line 286 of file ResultSetIteration.cpp.
bool ResultSet::isTruncated | ( | ) | const |
Definition at line 736 of file ResultSet.cpp.
bool ResultSet::isValidationOnlyRes | ( | ) | const |
Definition at line 748 of file ResultSet.cpp.
bool ResultSet::isZeroCopyColumnarConversionPossible | ( | size_t | column_idx | ) | const |
Definition at line 1379 of file ResultSet.cpp.
References Projection, and TableFunction.
void ResultSet::keepFirstN | ( | const size_t | n | ) |
Definition at line 52 of file ResultSet.cpp.
References anonymous_namespace{Utm.h}::n.
|
private |
Definition at line 649 of file ResultSetIteration.cpp.
References CHECK, CHECK_LT, ChunkIter_get_nth(), col_buffers_, ResultSet::StorageLookupResult::fixedup_entry_idx, getColumnFrag(), VarlenDatum::is_null, kENCODING_NONE, result_set::lazy_decode(), lazy_fetch_info_, VarlenDatum::length, VarlenDatum::pointer, row_set_mem_owner_, ResultSet::StorageLookupResult::storage_idx, and targets_.
|
private |
Definition at line 1467 of file ResultSetIteration.cpp.
References advance_to_next_columnar_target_buff(), CHECK, CHECK_EQ, CHECK_LT, col_buffers_, device_id_, device_type_, QueryMemoryDescriptor::didOutputColumnar(), findStorage(), geo_return_type_, SQLTypeInfo::get_compression(), SQLTypeInfo::get_type(), SQLTypeInfo::get_type_name(), getColumnFrag(), QueryMemoryDescriptor::getExecutor(), QueryMemoryDescriptor::getPaddedColWidthForRange(), QueryMemoryDescriptor::getPaddedSlotWidthBytes(), getStorageIndex(), getVarlenOutputInfo(), GPU, TargetInfo::is_agg, SQLTypeInfo::is_geometry(), ColumnLazyFetchInfo::is_lazily_fetched, kENCODING_GEOINT, kLINESTRING, kMULTIPOLYGON, kPOINT, kPOLYGON, lazy_fetch_info_, ColumnLazyFetchInfo::local_col_id, query_mem_desc_, read_int_from_buff(), separate_varlen_storage_valid_, serialized_varlen_buffer_, QueryMemoryDescriptor::slotIsVarlenOutput(), TargetInfo::sql_type, and UNREACHABLE.
Referenced by getTargetValueFromBufferColwise(), and getTargetValueFromBufferRowwise().
|
private |
Definition at line 1748 of file ResultSetIteration.cpp.
References TargetInfo::agg_kind, calculateQuantile(), catalog_, CHECK, CHECK_EQ, CHECK_GE, CHECK_LT, col_buffers_, count_distinct_set_size(), decimal_to_int_type(), exp_to_scale(), QueryMemoryDescriptor::forceFourByteFloat(), get_compact_type(), getColumnFrag(), QueryMemoryDescriptor::getCountDistinctDescriptor(), getStorageIndex(), inline_int_null_val(), anonymous_namespace{ResultSetIteration.cpp}::int_resize_cast(), TargetInfo::is_agg, SQLTypeInfo::is_date_in_days(), is_distinct_target(), QueryMemoryDescriptor::isLogicalSizedColumnsAllowed(), kAPPROX_QUANTILE, kAVG, kBIGINT, kENCODING_DICT, kFLOAT, kMAX, kMIN, kSINGLE_VALUE, kSUM, result_set::lazy_decode(), lazy_fetch_info_, NULL_DOUBLE, NULL_INT, query_mem_desc_, read_int_from_buff(), row_set_mem_owner_, and TargetInfo::sql_type.
Referenced by getTargetValueFromBufferColwise(), and getTargetValueFromBufferRowwise().
|
private |
Definition at line 1310 of file ResultSetIteration.cpp.
References anonymous_namespace{ResultSetIteration.cpp}::build_array_target_value(), catalog_, CHECK, CHECK_EQ, CHECK_GE, CHECK_GT, CHECK_LT, ChunkIter_get_nth(), col_buffers_, device_id_, device_type_, SQLTypeInfo::get_array_context_logical_size(), SQLTypeInfo::get_compression(), SQLTypeInfo::get_elem_type(), SQLTypeInfo::get_type(), getColumnFrag(), QueryMemoryDescriptor::getExecutor(), getQueryEngineCudaStreamForDevice(), getStorageIndex(), GPU, TargetInfo::is_agg, SQLTypeInfo::is_array(), VarlenDatum::is_null, SQLTypeInfo::is_string(), kARRAY, kENCODING_NONE, lazy_fetch_info_, VarlenDatum::length, run_benchmark_import::optional, VarlenDatum::pointer, query_mem_desc_, read_int_from_buff(), row_set_mem_owner_, separate_varlen_storage_valid_, serialized_varlen_buffer_, and TargetInfo::sql_type.
Referenced by getTargetValueFromBufferColwise(), and getTargetValueFromBufferRowwise().
void ResultSet::moveToBegin | ( | ) | const |
Definition at line 731 of file ResultSet.cpp.
|
private |
Definition at line 629 of file ResultSet.cpp.
References anonymous_namespace{ResultSet.cpp}::get_truncated_row_count(), threading_serial::parallel_reduce(), logger::query_id(), and logger::set_thread_local_query_id().
|
private |
Definition at line 866 of file ResultSet.cpp.
References gpu_enabled::copy(), cpu_threads(), DEBUG_TIMER, logger::query_id(), threading_std::task_group::run(), logger::set_thread_local_query_id(), and threading_std::task_group::wait().
|
private |
Definition at line 1262 of file ResultSet.cpp.
References apply_permutation_cpu(), CHECK, CHECK_EQ, DEBUG_TIMER, and sort_groups_cpu().
|
private |
Definition at line 1222 of file ResultSet.cpp.
References catalog_(), CHECK_GT, copy_group_by_buffers_from_gpu(), create_dev_group_by_buffers(), DEBUG_TIMER, getQueryEngineCudaStreamForDevice(), GPU, inplace_sort_gpu(), and KernelPerFragment.
size_t ResultSet::rowCount | ( | const bool | force_parallel = false | ) | const |
Returns the number of valid entries in the result set (i.e that will be returned from the SQL query or inputted into the next query step)
Note that this can be less than or equal to the value returned by ResultSet::getEntries(), whether due to a SQL LIMIT/OFFSET applied or because the result set representation is inherently sparse (i.e. baseline hash group by).
Internally this function references/sets a cached value (cached_row_count_
) so that the cost of computing the result is only paid once per result set.
If the actual row count is not cached and needs to be computed, in some cases that can be O(1) (i.e. if limits and offsets are present, or for the output of a table function). For projections, we use a binary search, so it is O(log n), otherwise it is O(n) (with n being ResultSet::entryCount()), which will be run in parallel if the entry count >= the default of 20000 or if force_parallel
is set to true
Note that we currently do not invalidate the cache if the result set is changed (i.e appended to), so this function should only be called after the result set is finalized.
force_parallel | Forces the row count to be computed in parallel if the row count cannot be otherwise be computed from metadata or via a binary search (otherwise parallel search is automatically used for result sets with entryCount() >= 20000 ) |
Definition at line 593 of file ResultSet.cpp.
References CHECK_GE, and uninitialized_cached_row_count.
|
private |
Definition at line 555 of file ResultSet.cpp.
References CHECK, anonymous_namespace{ResultSet.cpp}::get_truncated_row_count(), Projection, and TableFunction.
|
inline |
Definition at line 205 of file ResultSet.h.
Referenced by rowIterator().
|
inline |
Definition at line 220 of file ResultSet.h.
References rowIterator().
void ResultSet::serialize | ( | TSerializedRows & | serialized_rows | ) | const |
|
private |
|
private |
|
private |
|
inline |
void ResultSet::setCachedRowCount | ( | const size_t | row_count | ) | const |
Definition at line 609 of file ResultSet.cpp.
References CHECK, and uninitialized_cached_row_count.
|
inline |
|
inline |
Definition at line 529 of file ResultSet.h.
References geo_return_type_.
Referenced by initStatus().
|
inline |
Definition at line 491 of file ResultSet.h.
References input_table_keys_.
void ResultSet::setKernelQueueTime | ( | const int64_t | kernel_queue_time | ) |
Definition at line 714 of file ResultSet.cpp.
|
inline |
void ResultSet::setQueueTime | ( | const int64_t | queue_time | ) |
Definition at line 710 of file ResultSet.cpp.
|
inline |
Definition at line 571 of file ResultSet.h.
References separate_varlen_storage_valid_.
|
inline |
Definition at line 495 of file ResultSet.h.
References gpu_enabled::copy(), and target_meta_info_.
|
inline |
Definition at line 507 of file ResultSet.h.
References can_use_speculative_top_n_sort.
void ResultSet::setValidationOnlyRes | ( | ) |
Definition at line 744 of file ResultSet.cpp.
void ResultSet::sort | ( | const std::list< Analyzer::OrderEntry > & | order_entries, |
size_t | top_n, | ||
const Executor * | executor | ||
) |
Definition at line 768 of file ResultSet.cpp.
References Executor::baseline_threshold, CHECK, DEBUG_TIMER, g_enable_watchdog, g_parallel_top_max, g_parallel_top_min, LOG, VectorView< T >::size(), and logger::WARNING.
std::string ResultSet::summaryToString | ( | ) | const |
Definition at line 218 of file ResultSet.cpp.
void ResultSet::syncEstimatorBuffer | ( | ) | const |
Definition at line 696 of file ResultSet.cpp.
References CHECK, CHECK_EQ, checked_calloc(), data_mgr_(), getQueryEngineCudaStreamForDevice(), and GPU.