OmniSciDB
a5dc49c757
|
#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 int thread_idx, 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 ExecutorDeviceType device_type, 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 |
int | getThreadIdx () 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 |
const size_t | getColumnarBufferSize (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 |
bool | checkSlotUsesFlatBufferFormat (const size_t slot_idx) 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 ExecutorDeviceType device_type, 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 829 of file ResultSet.h.
|
private |
Definition at line 830 of file ResultSet.h.
|
private |
Definition at line 977 of file ResultSet.h.
|
strong |
Geo return type options when accessing geo columns from a result set.
Definition at line 542 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 int | thread_idx, | ||
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 93 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 165 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 181 of file ResultSet.cpp.
References CPU.
ResultSet::~ResultSet | ( | ) |
Definition at line 200 of file ResultSet.cpp.
References CHECK, CPU, and data_mgr_().
void ResultSet::addCompilationQueueTime | ( | const int64_t | compilation_queue_time | ) |
Definition at line 724 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 303 of file ResultSet.cpp.
References CHECK.
|
inline |
Definition at line 585 of file ResultSet.h.
References anonymous_namespace{QueryMemoryDescriptor.cpp}::any_of(), and lazy_fetch_info_.
|
private |
|
private |
Definition at line 622 of file ResultSet.cpp.
References anonymous_namespace{ResultSet.cpp}::get_truncated_row_count().
|
static |
Definition at line 1047 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 522 of file ResultSet.h.
References can_use_speculative_top_n_sort.
|
inline |
Definition at line 633 of file ResultSet.h.
References QueryMemoryDescriptor::checkSlotUsesFlatBufferFormat(), and query_mem_desc_.
|
inline |
Definition at line 467 of file ResultSet.h.
References permutation_.
Referenced by initStatus().
size_t ResultSet::colCount | ( | ) | const |
Definition at line 416 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 333 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 877 of file ResultSet.h.
References DEBUG_TIMER, QueryMemoryDescriptor::didOutputColumnar(), and query_mem_desc_.
bool ResultSet::definitelyHasNoRows | ( | ) | const |
Definition at line 674 of file ResultSet.cpp.
|
inline |
Definition at line 560 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 491 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 951 of file ResultSet.cpp.
Referenced by getVarlenOutputInfo(), and makeGeoTargetValue().
|
private |
|
static |
Definition at line 766 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 420 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 1508 of file ResultSet.cpp.
References CHECK.
const size_t ResultSet::getColumnarBufferSize | ( | size_t | column_idx | ) | const |
Definition at line 1513 of file ResultSet.cpp.
|
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 295 of file ResultSet.cpp.
|
private |
int8_t * ResultSet::getDeviceEstimatorBuffer | ( | ) | const |
Definition at line 692 of file ResultSet.cpp.
int ResultSet::getDeviceId | ( | ) | const |
Definition at line 758 of file ResultSet.cpp.
ExecutorDeviceType ResultSet::getDeviceType | ( | ) | const |
Definition at line 254 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 heavyai::GroupByBaselineHash, heavyai::GroupByPerfectHash, and UNREACHABLE.
|
inline |
|
inline |
Definition at line 631 of file ResultSet.h.
References QueryMemoryDescriptor::getExecutor(), and query_mem_desc_.
|
inline |
|
inline |
|
private |
|
inline |
int8_t * ResultSet::getHostEstimatorBuffer | ( | ) | const |
Definition at line 698 of file ResultSet.cpp.
|
inline |
Definition at line 508 of file ResultSet.h.
References input_table_keys_.
|
inline |
Definition at line 581 of file ResultSet.h.
References lazy_fetch_info_.
size_t ResultSet::getLimit | ( | ) | const |
Definition at line 1409 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 590 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 570 of file ResultSet.h.
References QueryMemoryDescriptor::getPaddedSlotWidthBytes(), and query_mem_desc_.
const Permutation & ResultSet::getPermutationBuffer | ( | ) | const |
Definition at line 874 of file ResultSet.cpp.
|
inline |
Definition at line 566 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 728 of file ResultSet.cpp.
int64_t ResultSet::getRenderTime | ( | ) | const |
Definition at line 733 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 450 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 1525 of file ResultSet.cpp.
References anonymous_namespace{RelAlgExecutor.cpp}::is_agg(), and kAVG.
std::vector< size_t > ResultSet::getSlotIndicesForTargetIndices | ( | ) | const |
Definition at line 1569 of file ResultSet.cpp.
References advance_slot().
const ResultSetStorage * ResultSet::getStorage | ( | ) | const |
Definition at line 412 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 926 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 2057 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 1413 of file ResultSet.cpp.
References CHECK.
StringDictionaryProxy * ResultSet::getStringDictionaryProxy | ( | const shared::StringDictKey & | dict_key | ) | const |
Definition at line 429 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 1549 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 683 of file ResultSet.cpp.
const std::vector< int64_t > & ResultSet::getTargetInitVals | ( | ) | const |
|
inline |
Definition at line 520 of file ResultSet.h.
References target_meta_info_.
|
private |
Definition at line 2266 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(), getTargetValueFromFlatBuffer(), TargetInfo::is_agg, SQLTypeInfo::is_geometry(), is_real_str_or_array(), FlatBufferManager::isFlatBuffer(), kAVG, anonymous_namespace{ResultSetIteration.cpp}::make_avg_target_value(), makeGeoTargetValue(), makeTargetValue(), makeVarlenTargetValue(), query_mem_desc_, TargetInfo::sql_type, QueryMemoryDescriptor::targetGroupbyIndicesSize(), and SQLTypeInfo::usesFlatBuffer().
|
private |
Definition at line 2350 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_, separate_varlen_storage_valid_, TargetInfo::sql_type, storage_, QueryMemoryDescriptor::targetGroupbyIndicesSize(), UNLIKELY, and SQLTypeInfo::usesFlatBuffer().
int ResultSet::getThreadIdx | ( | ) | const |
Definition at line 762 of file ResultSet.cpp.
References thread_idx_().
const std::pair< std::vector< int32_t >, std::vector< std::string > > ResultSet::getUniqueStringsForDictEncodedTargetCol | ( | const size_t | col_idx | ) | const |
Definition at line 1422 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 443 of file ResultSet.h.
References chunk_iters_.
|
inline |
Definition at line 440 of file ResultSet.h.
References chunks_.
|
inline |
Definition at line 446 of file ResultSet.h.
References literal_buffers_.
void ResultSet::initializeStorage | ( | ) | const |
Definition at line 1042 of file ResultSetReduction.cpp.
|
private |
Definition at line 858 of file ResultSet.cpp.
References CHECK, DEBUG_TIMER, and VectorView< T >::push_back().
|
inline |
Definition at line 473 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 611 of file ResultSet.cpp.
References uninitialized_cached_row_count.
Referenced by initStatus().
|
inline |
Definition at line 485 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 1477 of file ResultSet.cpp.
References CHECK, g_enable_direct_columnarization, heavyai::GroupByBaselineHash, heavyai::GroupByPerfectHash, heavyai::Projection, and heavyai::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 655 of file ResultSet.cpp.
|
inline |
Definition at line 494 of file ResultSet.h.
References estimator_.
bool ResultSet::isExplain | ( | ) | const |
Definition at line 746 of file ResultSet.cpp.
bool ResultSet::isGeoColOnGpu | ( | const size_t | col_idx | ) | const |
Definition at line 1489 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 2601 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 742 of file ResultSet.cpp.
bool ResultSet::isValidationOnlyRes | ( | ) | const |
Definition at line 754 of file ResultSet.cpp.
bool ResultSet::isZeroCopyColumnarConversionPossible | ( | size_t | column_idx | ) | const |
Definition at line 1499 of file ResultSet.cpp.
References heavyai::Projection, and heavyai::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 1652 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, FlatBufferManager::isFlatBuffer(), kENCODING_GEOINT, kLINESTRING, kMULTILINESTRING, kMULTIPOINT, kMULTIPOLYGON, kPOINT, kPOLYGON, lazy_fetch_info_, ColumnLazyFetchInfo::local_col_id, NestedArrayToGeoTargetValue(), 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 2072 of file ResultSetIteration.cpp.
References getString(), and NULL_INT.
Referenced by convertToScalarTargetValue(), and makeTargetValue().
|
private |
Definition at line 2087 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, 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 737 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 635 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 878 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 1369 of file ResultSet.cpp.
References apply_permutation_cpu(), CHECK, CHECK_EQ, DEBUG_TIMER, and sort_groups_cpu().
|
private |
Definition at line 1329 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.