OmniSciDB
c1a53651b2
|
#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 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 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 |
std::string | getString (SQLTypeInfo const &, int64_t const ival) const |
ScalarTargetValue | convertToScalarTargetValue (SQLTypeInfo const &, bool const translate_strings, int64_t const val) const |
bool | isLessThan (SQLTypeInfo const &, int64_t const lhs, int64_t const rhs) 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 |
unsigned | getBlockSize () const |
unsigned | getGridSize () 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 shared::StringDictKey &dict_key) const |
const std::pair< std::vector < int32_t >, std::vector < std::string > > | getUniqueStringsForDictEncodedTargetCol (const size_t col_idx) const |
StringDictionaryProxy * | getStringDictionaryProxy (const shared::StringDictKey &dict_key) 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 bool | isNullIval (SQLTypeInfo const &, bool const translate_strings, int64_t const ival) |
static ScalarTargetValue | nullScalarTargetValue (SQLTypeInfo const &, bool const translate_strings) |
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 | ModeBuffers = std::vector< std::vector< int64_t >> |
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 |
ScalarTargetValue | makeStringTargetValue (SQLTypeInfo const &chosen_type, bool const translate_strings, int64_t const ival) 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 157 of file ResultSet.h.
|
private |
Definition at line 821 of file ResultSet.h.
|
private |
Definition at line 822 of file ResultSet.h.
|
private |
Definition at line 967 of file ResultSet.h.
|
strong |
Geo return type options when accessing geo columns from a result set.
Definition at line 539 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 unsigned | block_size, | ||
const unsigned | grid_size | ||
) |
Definition at line 64 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 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 161 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 176 of file ResultSet.cpp.
References CPU.
ResultSet::~ResultSet | ( | ) |
Definition at line 194 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 297 of file ResultSet.cpp.
References CHECK.
|
inline |
Definition at line 581 of file ResultSet.h.
References anonymous_namespace{QueryMemoryDescriptor.cpp}::any_of(), and 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 1035 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 519 of file ResultSet.h.
References can_use_speculative_top_n_sort.
|
inline |
Definition at line 464 of file ResultSet.h.
References permutation_.
Referenced by initStatus().
size_t ResultSet::colCount | ( | ) | const |
Definition at line 410 of file ResultSet.cpp.
ScalarTargetValue ResultSet::convertToScalarTargetValue | ( | SQLTypeInfo const & | ti, |
bool const | translate_strings, | ||
int64_t const | val | ||
) | const |
Definition at line 1088 of file ResultSetIteration.cpp.
References CHECK_EQ, SQLTypeInfo::get_compression(), SQLTypeInfo::is_any(), SQLTypeInfo::is_string(), kDOUBLE, kENCODING_DICT, kFLOAT, and makeStringTargetValue().
Referenced by makeTargetValue().
ResultSetPtr ResultSet::copy | ( | ) |
Definition at line 327 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 1171 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 869 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 557 of file ResultSet.h.
References QueryMemoryDescriptor::didOutputColumnar(), and query_mem_desc_.
|
private |
void ResultSet::dropFirstN | ( | const size_t | n | ) |
Definition at line 59 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().
|
inline |
size_t ResultSet::getBufferSizeBytes | ( | const ExecutorDeviceType | device_type | ) | const |
SQLTypeInfo ResultSet::getColType | ( | const size_t | col_idx | ) | const |
Definition at line 414 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 1343 of file ResultSetIteration.cpp.
References CHECK_NE, and storage_.
const int8_t * ResultSet::getColumnarBuffer | ( | size_t | column_idx | ) | const |
Definition at line 1496 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 1289 of file ResultSetIteration.cpp.
References storage_.
|
private |
Definition at line 1136 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 289 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 248 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 1213 of file ResultSetIteration.cpp.
References GroupByBaselineHash, GroupByPerfectHash, and UNREACHABLE.
|
inline |
|
inline |
Definition at line 627 of file ResultSet.h.
References QueryMemoryDescriptor::getExecutor(), and query_mem_desc_.
|
inline |
|
inline |
|
private |
|
inline |
int8_t * ResultSet::getHostEstimatorBuffer | ( | ) | const |
Definition at line 692 of file ResultSet.cpp.
|
inline |
Definition at line 505 of file ResultSet.h.
References input_table_keys_.
|
inline |
Definition at line 577 of file ResultSet.h.
References lazy_fetch_info_.
size_t ResultSet::getLimit | ( | ) | const |
Definition at line 1397 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 296 of file ResultSetIteration.cpp.
|
private |
Definition at line 318 of file ResultSetIteration.cpp.
References CHECK, and CHECK_EQ.
|
private |
Definition at line 305 of file ResultSetIteration.cpp.
|
inline |
Definition at line 586 of file ResultSet.h.
References lazy_fetch_info_.
OneIntegerColumnRow ResultSet::getOneColRow | ( | const size_t | index | ) | const |
Definition at line 234 of file ResultSetIteration.cpp.
References align_to_int64(), CHECK, get_key_bytes_rowwise(), and row_ptr_rowwise().
|
inline |
Definition at line 566 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 562 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 273 of file ResultSetIteration.cpp.
|
inline |
Definition at line 447 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 1321 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 1304 of file ResultSetIteration.cpp.
References storage_.
std::tuple< std::vector< bool >, size_t > ResultSet::getSingleSlotTargetBitmap | ( | ) | const |
Definition at line 1502 of file ResultSet.cpp.
References anonymous_namespace{RelAlgExecutor.cpp}::is_agg(), and kAVG.
std::vector< size_t > ResultSet::getSlotIndicesForTargetIndices | ( | ) | const |
Definition at line 1546 of file ResultSet.cpp.
References advance_slot().
const ResultSetStorage * ResultSet::getStorage | ( | ) | const |
Definition at line 406 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().
std::string ResultSet::getString | ( | SQLTypeInfo const & | ti, |
int64_t const | ival | ||
) | const |
Definition at line 1867 of file ResultSetIteration.cpp.
References StringDictionaryProxy::getString(), SQLTypeInfo::getStringDictKey(), and row_set_mem_owner_.
Referenced by anonymous_namespace{ResultSetIteration.cpp}::build_string_array_target_value(), isLessThan(), and makeStringTargetValue().
const std::vector< std::string > ResultSet::getStringDictionaryPayloadCopy | ( | const shared::StringDictKey & | dict_key | ) | const |
Definition at line 1401 of file ResultSet.cpp.
References CHECK.
StringDictionaryProxy * ResultSet::getStringDictionaryProxy | ( | const shared::StringDictKey & | dict_key | ) | const |
Definition at line 423 of file ResultSet.cpp.
References shared::StringDictKey::db_id, shared::StringDictKey::dict_id, and dict_ref_t::literalsDictId.
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 1526 of file ResultSet.cpp.
References CHECK, CHECK_GE, is_distinct_target(), 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 517 of file ResultSet.h.
References target_meta_info_.
|
private |
Definition at line 2028 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 2101 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 1410 of file ResultSet.cpp.
References 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 1161 of file ResultSetIteration.cpp.
References CHECK, and findStorage().
Referenced by makeGeoTargetValue().
|
inline |
|
inline |
Definition at line 440 of file ResultSet.h.
References chunk_iters_.
|
inline |
Definition at line 437 of file ResultSet.h.
References chunks_.
|
inline |
Definition at line 443 of file ResultSet.h.
References literal_buffers_.
void ResultSet::initializeStorage | ( | ) | const |
Definition at line 1043 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 470 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 482 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 1465 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 491 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 1479 of file ResultSetIteration.cpp.
References CHECK_LT, device_type_, GPU, IS_GEO, lazy_fetch_info_, separate_varlen_storage_valid_, targets_, and to_string().
bool ResultSet::isLessThan | ( | SQLTypeInfo const & | ti, |
int64_t const | lhs, | ||
int64_t const | rhs | ||
) | const |
Definition at line 1111 of file ResultSetIteration.cpp.
References shared::bit_cast(), CHECK_EQ, SQLTypeInfo::get_compression(), getString(), SQLTypeInfo::is_any(), SQLTypeInfo::is_string(), kDOUBLE, kENCODING_DICT, and kFLOAT.
|
staticprivate |
Definition at line 2344 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().
|
static |
Definition at line 1126 of file ResultSetIteration.cpp.
References inline_int_null_val(), SQLTypeInfo::is_any(), SQLTypeInfo::is_string(), kDOUBLE, kFLOAT, NULL_DOUBLE, NULL_FLOAT, and NULL_INT.
Referenced by makeTargetValue().
|
inline |
bool ResultSet::isRowAtEmpty | ( | const size_t | index | ) | const |
Definition at line 284 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 1487 of file ResultSet.cpp.
References Projection, and TableFunction.
void ResultSet::keepFirstN | ( | const size_t | n | ) |
Definition at line 54 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 1510 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, kMULTILINESTRING, kMULTIPOINT, 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 1882 of file ResultSetIteration.cpp.
References getString(), and NULL_INT.
Referenced by convertToScalarTargetValue(), and makeTargetValue().
|
private |
Definition at line 1897 of file ResultSetIteration.cpp.
References TargetInfo::agg_kind, calculateQuantile(), CHECK, CHECK_EQ, CHECK_GE, CHECK_LT, col_buffers_, convertToScalarTargetValue(), 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(), isNullIval(), kAPPROX_QUANTILE, kAVG, kBIGINT, kENCODING_DICT, kFLOAT, kMAX, kMIN, kMODE, kSINGLE_VALUE, kSUM, kSUM_IF, result_set::lazy_decode(), lazy_fetch_info_, makeStringTargetValue(), NULL_DOUBLE, nullScalarTargetValue(), query_mem_desc_, read_int_from_buff(), and TargetInfo::sql_type.
Referenced by getTargetValueFromBufferColwise(), and getTargetValueFromBufferRowwise().
|
private |
Definition at line 1358 of file ResultSetIteration.cpp.
References anonymous_namespace{ResultSetIteration.cpp}::build_array_target_value(), 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(), FlatBufferManager::isFlatBuffer(), 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_, TargetInfo::sql_type, and VarlenArray_get_nth().
Referenced by getTargetValueFromBufferColwise(), and getTargetValueFromBufferRowwise().
void ResultSet::moveToBegin | ( | ) | const |
Definition at line 731 of file ResultSet.cpp.
|
static |
Definition at line 1101 of file ResultSetIteration.cpp.
References inline_int_null_val(), SQLTypeInfo::is_any(), SQLTypeInfo::is_string(), kDOUBLE, kFLOAT, NULL_DOUBLE, NULL_FLOAT, and NULL_INT.
Referenced by makeTargetValue().
|
private |
Definition at line 629 of file ResultSet.cpp.
References anonymous_namespace{ResultSet.cpp}::get_truncated_row_count(), threading_serial::parallel_reduce(), and logger::thread_local_ids().
|
private |
Definition at line 866 of file ResultSet.cpp.
References gpu_enabled::copy(), cpu_threads(), DEBUG_TIMER, threading_std::task_group::run(), logger::thread_local_ids(), and threading_std::task_group::wait().
|
private |
Definition at line 1357 of file ResultSet.cpp.
References apply_permutation_cpu(), CHECK, CHECK_EQ, DEBUG_TIMER, and sort_groups_cpu().
|
private |
Definition at line 1317 of file ResultSet.cpp.
References CHECK_GT, copy_group_by_buffers_from_gpu(), create_dev_group_by_buffers(), DEBUG_TIMER, Catalog_Namespace::SysCatalog::getDataMgr(), getQueryEngineCudaStreamForDevice(), GPU, inplace_sort_gpu(), Catalog_Namespace::SysCatalog::instance(), 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 201 of file ResultSet.h.
Referenced by rowIterator().
|
inline |
Definition at line 216 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 |