OmniSciDB
a5dc49c757
|
#include <QueryRunner.h>
Public Member Functions | |
std::shared_ptr < Catalog_Namespace::SessionInfo > | getSession () const |
void | addSessionId (const std::string &session_id, ExecutorDeviceType device_type=ExecutorDeviceType::GPU) |
void | clearSessionId () |
std::shared_ptr < Catalog_Namespace::Catalog > | getCatalog () const |
std::shared_ptr< Calcite > | getCalcite () const |
std::shared_ptr< Executor > | getExecutor () const |
Catalog_Namespace::UserMetadata & | getUserMetadata () const |
bool | gpusPresent () const |
virtual void | clearGpuMemory () const |
virtual void | clearCpuMemory () const |
std::vector< MemoryInfo > | getMemoryInfo (const Data_Namespace::MemoryLevel memory_level) const |
BufferPoolStats | getBufferPoolStats (const Data_Namespace::MemoryLevel memory_level, const bool current_db_only) const |
virtual std::unique_ptr < Parser::Stmt > | createStatement (const std::string &) |
virtual void | runDDLStatement (const std::string &) |
virtual void | validateDDLStatement (const std::string &) |
virtual std::shared_ptr < ResultSet > | runSQL (const std::string &query_str, CompilationOptions co, ExecutionOptions eo) |
virtual std::shared_ptr < ExecutionResult > | runSelectQuery (const std::string &query_str, CompilationOptions co, ExecutionOptions eo) |
virtual std::shared_ptr < ResultSet > | runSQL (const std::string &query_str, const ExecutorDeviceType device_type, const bool hoist_literals=true, const bool allow_loop_joins=true) |
virtual std::shared_ptr < ExecutionResult > | runSelectQuery (const std::string &query_str, const ExecutorDeviceType device_type, const bool hoist_literals, const bool allow_loop_joins, const bool just_explain=false) |
virtual std::shared_ptr < ResultSet > | runSQLWithAllowingInterrupt (const std::string &query_str, const std::string &session_id, const ExecutorDeviceType device_type, const double running_query_check_freq=0.9, const unsigned pending_query_check_freq=1000) |
virtual std::vector < std::shared_ptr< ResultSet > > | runMultipleStatements (const std::string &, const ExecutorDeviceType) |
virtual void | runImport (Parser::CopyTableStmt *import_stmt) |
virtual std::unique_ptr < import_export::Loader > | getLoader (const TableDescriptor *td) const |
RegisteredQueryHint | getParsedQueryHint (const std::string &) |
std::optional < std::unordered_map< size_t, std::unordered_map< unsigned, RegisteredQueryHint > > > | getParsedQueryHints (const std::string &query_str) |
std::shared_ptr< const RelAlgNode > | getRootNodeFromParsedQuery (const std::string &query_str) |
std::optional < RegisteredQueryHint > | getParsedGlobalQueryHints (const std::string &query_str) |
RaExecutionSequence | getRaExecutionSequence (const std::string &query_str) |
virtual std::shared_ptr < ResultSet > | getCalcitePlan (const std::string &query_str, bool enable_watchdog, bool is_explain_as_json_str, bool is_explain_detailed) const |
std::tuple< QueryPlanHash, std::shared_ptr< HashTable > , std::optional < HashtableCacheMetaInfo > > | getCachedHashtableWithoutCacheKey (std::set< size_t > &visited, CacheItemType hash_table_type, DeviceIdentifier device_identifier) |
std::shared_ptr< CacheItemMetric > | getCacheItemMetric (QueryPlanHash cache_key, CacheItemType hash_table_type, DeviceIdentifier device_identifier) |
size_t | getNumberOfCachedItem (CacheItemStatus item_status, CacheItemType hash_table_type, bool with_bbox_intersect_tuning_param=false) const |
void | resizeDispatchQueue (const size_t num_executors) |
QueryPlanDagInfo | getQueryInfoForDataRecyclerTest (const std::string &) |
std::shared_ptr< RelAlgTranslator > | getRelAlgTranslator (const std::string &, Executor *) |
ExtractedQueryPlanDag | extractQueryPlanDag (const std::string &) |
std::unique_ptr< RelAlgDag > | getRelAlgDag (const std::string &) |
QueryRunner (std::unique_ptr< Catalog_Namespace::SessionInfo > session) | |
virtual | ~QueryRunner ()=default |
void | setExplainType (const ExecutorExplainType explain_type) |
Static Public Member Functions | |
static QueryRunner * | init (const char *db_path, const std::string &udf_filename="", const size_t max_gpu_mem=0, const int reserved_gpu_mem=256<< 20) |
static QueryRunner * | init (const File_Namespace::DiskCacheConfig *disk_cache_config, const char *db_path, const std::vector< LeafHostInfo > &string_servers={}, const std::vector< LeafHostInfo > &leaf_servers={}) |
static QueryRunner * | init (const char *db_path, const std::vector< LeafHostInfo > &string_servers, const std::vector< LeafHostInfo > &leaf_servers) |
static QueryRunner * | init (const char *db_path, const std::string &user, const std::string &pass, const std::string &db_name, const std::vector< LeafHostInfo > &string_servers, const std::vector< LeafHostInfo > &leaf_servers, const std::string &udf_filename="", bool uses_gpus=true, const size_t max_gpu_mem=0, const int reserved_gpu_mem=256<< 20, const bool create_user=false, const bool create_db=false, const File_Namespace::DiskCacheConfig *config=nullptr) |
static QueryRunner * | init (std::unique_ptr< Catalog_Namespace::SessionInfo > &session) |
static QueryRunner * | get () |
static void | reset () |
static ExecutionOptions | defaultExecutionOptionsForRunSQL (bool allow_loop_joins=true, bool just_explain=false) |
template<typename... Ts> | |
static std::shared_ptr < query_state::QueryState > | create_query_state (Ts &&...args) |
Static Public Attributes | |
static query_state::QueryStates | query_states_ |
Protected Member Functions | |
QueryRunner (const char *db_path, const std::string &user, const std::string &pass, const std::string &db_name, const std::vector< LeafHostInfo > &string_servers, const std::vector< LeafHostInfo > &leaf_servers, const std::string &udf_filename, bool uses_gpus, const size_t max_gpu_mem, const int reserved_gpu_mem, const bool create_user, const bool create_db, const File_Namespace::DiskCacheConfig *disk_cache_config=nullptr) | |
Protected Attributes | |
ExecutorExplainType | explain_type_ = ExecutorExplainType::Default |
Catalog_Namespace::DBMetadata | db_metadata_ |
std::shared_ptr < Catalog_Namespace::SessionInfo > | session_info_ |
std::unique_ptr < QueryDispatchQueue > | dispatch_queue_ |
std::shared_ptr< QueryEngine > | query_engine_ |
Static Protected Attributes | |
static std::unique_ptr < QueryRunner > | qr_instance_ = nullptr |
Definition at line 139 of file QueryRunner.h.
QueryRunner::QueryRunner::QueryRunner | ( | std::unique_ptr< Catalog_Namespace::SessionInfo > | session | ) |
|
virtualdefault |
|
protected |
Definition at line 156 of file QueryRunner.cpp.
References ExtensionFunctionsWhitelist::add(), ExtensionFunctionsWhitelist::addUdfs(), SystemParameters::aggregator, anonymous_namespace{QueryRunner.cpp}::calcite_shutdown_handler(), CALCITEPORT, cat(), CHECK, cpu_threads(), QueryEngine::createInstance(), db_metadata_, Catalog_Namespace::DBMetadata::dbOwner, File_Namespace::fsi, g_base_path, anonymous_namespace{QueryRunner.cpp}::g_calcite, g_enable_executor_resource_mgr, g_read_only, g_serialize_temp_tables, table_functions::TableFunctionsFactory::get_table_funcs(), GPU, SystemParameters::gpu_buffer_mem_bytes, Executor::init_resource_mgr(), table_functions::init_table_functions(), Catalog_Namespace::SysCatalog::instance(), Catalog_Namespace::UserMetadata::isSuper, shared::kCatalogDirectoryName, shared::kDataDirectoryName, shared::kDefaultDbName, shared::kDefaultDiskCacheDirName, RuntimeLibManager::loadRuntimeLibs(), RuntimeLibManager::loadTestRuntimeLibs(), Catalog_Namespace::UserMetadata::passwd_hash, query_engine_, session_info_, logger::set_once_fatal_func(), anonymous_namespace{QueryRunner.cpp}::setup_signal_handler(), ThriftSerializers::to_thrift(), and Catalog_Namespace::UserMetadata::userId.
|
inline |
Definition at line 194 of file QueryRunner.h.
References session_info_.
|
virtual |
Definition at line 316 of file QueryRunner.cpp.
References CHECK, Executor::clearMemory(), Data_Namespace::CPU_LEVEL, and Catalog_Namespace::SysCatalog::instance().
|
virtual |
Definition at line 311 of file QueryRunner.cpp.
References CHECK, Executor::clearMemory(), Data_Namespace::GPU_LEVEL, and Catalog_Namespace::SysCatalog::instance().
|
inline |
Definition at line 201 of file QueryRunner.h.
References session_info_.
|
inlinestatic |
Definition at line 304 of file QueryRunner.h.
References run_benchmark_import::args, query_state::QueryStates::create(), and query_states_.
Referenced by createStatement(), getCalcitePlan(), getExecutor(), getParsedGlobalQueryHints(), getParsedQueryHint(), getParsedQueryHints(), getQueryInfoForDataRecyclerTest(), getRaExecutionSequence(), getRelAlgDag(), getRelAlgTranslator(), getRootNodeFromParsedQuery(), runDDLStatement(), runSelectQuery(), runSQLWithAllowingInterrupt(), and validateDDLStatement().
|
virtual |
Definition at line 563 of file QueryRunner.cpp.
References cat(), CHECK, create_query_state(), Parser::create_stmt_for_json(), g_enable_watchdog, Catalog_Namespace::SysCatalog::instance(), pg_shim(), session_info_, STDLOG, and UNREACHABLE.
|
static |
Definition at line 668 of file QueryRunner.cpp.
References g_enable_columnar_output, and g_gpu_mem_limit_percent.
Referenced by runSelectQuery(), and runSQL().
ExtractedQueryPlanDag QueryRunner::QueryRunner::extractQueryPlanDag | ( | const std::string & | query_str | ) |
Definition at line 1001 of file QueryRunner.cpp.
References QueryPlanDagExtractor::extractQueryPlanDag(), Executor::getExecutor(), getQueryInfoForDataRecyclerTest(), and Executor::UNITARY_EXECUTOR_ID.
|
inlinestatic |
Definition at line 181 of file QueryRunner.h.
References qr_instance_.
BufferPoolStats QueryRunner::QueryRunner::getBufferPoolStats | ( | const Data_Namespace::MemoryLevel | memory_level, |
const bool | current_db_only | ||
) | const |
Definition at line 327 of file QueryRunner.cpp.
References CHECK, CHECK_EQ, Data_Namespace::CPU_LEVEL, db_metadata_, Catalog_Namespace::DBMetadata::dbId, Buffer_Namespace::FREE, Catalog_Namespace::SysCatalog::instance(), and session_info_.
std::tuple< QueryPlanHash, std::shared_ptr< HashTable >, std::optional< HashtableCacheMetaInfo > > QueryRunner::QueryRunner::getCachedHashtableWithoutCacheKey | ( | std::set< size_t > & | visited, |
CacheItemType | hash_table_type, | ||
DeviceIdentifier | device_identifier | ||
) |
Definition at line 1061 of file QueryRunner.cpp.
References BASELINE_HT, BBOX_INTERSECT_HT, CHECK, BoundingBoxIntersectJoinHashTable::getHashTableCache(), PerfectJoinHashTable::getHashTableCache(), BaselineJoinHashTable::getHashTableCache(), PERFECT_HT, and UNREACHABLE.
std::shared_ptr< CacheItemMetric > QueryRunner::QueryRunner::getCacheItemMetric | ( | QueryPlanHash | cache_key, |
CacheItemType | hash_table_type, | ||
DeviceIdentifier | device_identifier | ||
) |
Definition at line 1088 of file QueryRunner.cpp.
References BASELINE_HT, BBOX_INTERSECT_HT, CHECK, BoundingBoxIntersectJoinHashTable::getHashTableCache(), PerfectJoinHashTable::getHashTableCache(), BaselineJoinHashTable::getHashTableCache(), PERFECT_HT, and UNREACHABLE.
std::shared_ptr< Calcite > QueryRunner::QueryRunner::getCalcite | ( | ) | const |
Definition at line 301 of file QueryRunner.cpp.
References anonymous_namespace{QueryRunner.cpp}::g_calcite.
|
virtual |
Definition at line 883 of file QueryRunner.cpp.
References cat(), CHECK, create_query_state(), dispatch_queue_, g_enable_calcite_view_optimize, Executor::getExecutor(), Catalog_Namespace::SysCatalog::instance(), pg_shim(), run_benchmark_import::result, session_info_, STDLOG, and logger::thread_local_ids().
std::shared_ptr< Catalog_Namespace::Catalog > QueryRunner::QueryRunner::getCatalog | ( | ) | const |
Definition at line 296 of file QueryRunner.cpp.
References CHECK, and session_info_.
Referenced by getLoader().
std::shared_ptr< Executor > QueryRunner::QueryRunner::getExecutor | ( | ) | const |
Definition at line 689 of file QueryRunner.cpp.
References CHECK, create_query_state(), Executor::getExecutor(), Catalog_Namespace::SysCatalog::instance(), session_info_, STDLOG, and Executor::UNITARY_EXECUTOR_ID.
|
virtual |
Definition at line 811 of file QueryRunner.cpp.
References cat(), and getCatalog().
std::vector< MemoryInfo > QueryRunner::QueryRunner::getMemoryInfo | ( | const Data_Namespace::MemoryLevel | memory_level | ) | const |
Definition at line 321 of file QueryRunner.cpp.
References CHECK, Catalog_Namespace::SysCatalog::instance(), and session_info_.
size_t QueryRunner::QueryRunner::getNumberOfCachedItem | ( | CacheItemStatus | item_status, |
CacheItemType | hash_table_type, | ||
bool | with_bbox_intersect_tuning_param = false |
||
) | const |
Definition at line 1116 of file QueryRunner.cpp.
References QueryRunner::ALL, BASELINE_HT, BBOX_INTERSECT_AUTO_TUNER_PARAM, BBOX_INTERSECT_HT, CHECK, CHECK_EQ, QueryRunner::CLEAN_ONLY, DataRecyclerUtil::CPU_DEVICE_IDENTIFIER, QueryRunner::DIRTY_ONLY, BoundingBoxIntersectJoinHashTable::getBoundingBoxIntersectTuningParamCache(), BoundingBoxIntersectJoinHashTable::getHashTableCache(), PerfectJoinHashTable::getHashTableCache(), BaselineJoinHashTable::getHashTableCache(), PERFECT_HT, and UNREACHABLE.
std::optional< RegisteredQueryHint > QueryRunner::QueryRunner::getParsedGlobalQueryHints | ( | const std::string & | query_str | ) |
Definition at line 443 of file QueryRunner.cpp.
References cat(), CHECK, create_query_state(), g_enable_watchdog, Executor::getExecutor(), RelAlgExecutor::getGlobalQueryHint(), Catalog_Namespace::SysCatalog::instance(), pg_shim(), session_info_, and Executor::UNITARY_EXECUTOR_ID.
RegisteredQueryHint QueryRunner::QueryRunner::getParsedQueryHint | ( | const std::string & | query_str | ) |
Definition at line 373 of file QueryRunner.cpp.
References cat(), CHECK, create_query_state(), RegisteredQueryHint::defaults(), g_enable_watchdog, Executor::getExecutor(), RelAlgExecutor::getParsedQueryHint(), Catalog_Namespace::SysCatalog::instance(), pg_shim(), session_info_, and Executor::UNITARY_EXECUTOR_ID.
std::optional< std::unordered_map< size_t, std::unordered_map< unsigned, RegisteredQueryHint > > > QueryRunner::QueryRunner::getParsedQueryHints | ( | const std::string & | query_str | ) |
Definition at line 422 of file QueryRunner.cpp.
References cat(), CHECK, create_query_state(), g_enable_watchdog, Executor::getExecutor(), RelAlgExecutor::getParsedQueryHints(), Catalog_Namespace::SysCatalog::instance(), pg_shim(), session_info_, and Executor::UNITARY_EXECUTOR_ID.
QueryPlanDagInfo QueryRunner::QueryRunner::getQueryInfoForDataRecyclerTest | ( | const std::string & | query_str | ) |
Definition at line 535 of file QueryRunner.cpp.
References cat(), CHECK, create_query_state(), g_enable_watchdog, Executor::getExecutor(), RelAlgExecutor::getRootRelAlgNodeShPtr(), Catalog_Namespace::SysCatalog::instance(), pg_shim(), session_info_, and Executor::UNITARY_EXECUTOR_ID.
Referenced by extractQueryPlanDag().
RaExecutionSequence QueryRunner::QueryRunner::getRaExecutionSequence | ( | const std::string & | query_str | ) |
Definition at line 465 of file QueryRunner.cpp.
References cat(), CHECK, create_query_state(), g_enable_watchdog, Executor::getExecutor(), RelAlgExecutor::getRaExecutionSequence(), Catalog_Namespace::SysCatalog::instance(), pg_shim(), session_info_, and Executor::UNITARY_EXECUTOR_ID.
std::unique_ptr< RelAlgDag > QueryRunner::QueryRunner::getRelAlgDag | ( | const std::string & | query_str | ) |
Definition at line 1009 of file QueryRunner.cpp.
References cat(), CHECK, create_query_state(), ExecutionOptions::defaults(), dispatch_queue_, g_enable_calcite_view_optimize, g_enable_watchdog, Executor::getExecutor(), RelAlgExecutor::getOwnedRelAlgDag(), Catalog_Namespace::SysCatalog::instance(), pg_shim(), session_info_, STDLOG, and logger::thread_local_ids().
std::shared_ptr< RelAlgTranslator > QueryRunner::QueryRunner::getRelAlgTranslator | ( | const std::string & | query_str, |
Executor * | executor | ||
) |
Definition at line 512 of file QueryRunner.cpp.
References cat(), CHECK, create_query_state(), g_enable_watchdog, Catalog_Namespace::SysCatalog::instance(), pg_shim(), and session_info_.
std::shared_ptr< const RelAlgNode > QueryRunner::QueryRunner::getRootNodeFromParsedQuery | ( | const std::string & | query_str | ) |
Definition at line 397 of file QueryRunner.cpp.
References cat(), CHECK, create_query_state(), g_enable_watchdog, Executor::getExecutor(), RelAlgExecutor::getRootRelAlgNodeShPtr(), Catalog_Namespace::SysCatalog::instance(), pg_shim(), session_info_, and Executor::UNITARY_EXECUTOR_ID.
|
inline |
Definition at line 190 of file QueryRunner.h.
References session_info_.
Catalog_Namespace::UserMetadata& QueryRunner::QueryRunner::getUserMetadata | ( | ) | const |
bool QueryRunner::QueryRunner::gpusPresent | ( | ) | const |
Definition at line 306 of file QueryRunner.cpp.
References CHECK, and session_info_.
|
static |
Definition at line 87 of file QueryRunner.cpp.
References logger::init(), shared::kDefaultDbName, and shared::kRootUsername.
|
static |
Definition at line 103 of file QueryRunner.cpp.
References logger::init(), shared::kDefaultDbName, and shared::kRootUsername.
|
inlinestatic |
Definition at line 151 of file QueryRunner.h.
References logger::init(), shared::kDefaultDbName, and shared::kRootUsername.
|
static |
Definition at line 122 of file QueryRunner.cpp.
References CHECK, ddl_utils::FilePathWhitelist::clear(), logger::FATAL, ddl_utils::FilePathWhitelist::initialize(), and LOG_IF.
|
inlinestatic |
Definition at line 176 of file QueryRunner.h.
References qr_instance_, and QueryRunner().
|
static |
Definition at line 1218 of file QueryRunner.cpp.
References anonymous_namespace{QueryRunner.cpp}::calcite_shutdown_handler(), and qr_instance_.
void QueryRunner::QueryRunner::resizeDispatchQueue | ( | const size_t | num_executors | ) |
Definition at line 288 of file QueryRunner.cpp.
References dispatch_queue_.
|
virtual |
Definition at line 600 of file QueryRunner.cpp.
References cat(), CHECK, create_query_state(), DdlCommandExecutor::execute(), g_enable_watchdog, ParserWrapper::Insert, Catalog_Namespace::SysCatalog::instance(), pg_shim(), session_info_, and STDLOG.
Referenced by QueryRunner::ImportDriver::importGeoTable(), runMultipleStatements(), and runSQL().
|
virtual |
Definition at line 806 of file QueryRunner.cpp.
References CHECK, Parser::CopyTableStmt::execute(), and session_info_.
|
virtual |
Definition at line 782 of file QueryRunner.cpp.
References field(), ParserWrapper::Insert, runDDLStatement(), runSQL(), split(), and strip().
|
virtual |
Definition at line 929 of file QueryRunner.cpp.
References ExecutionOptions::allow_loop_joins, cat(), CHECK, create_query_state(), CompilationOptions::defaults(), CompilationOptions::device_type, dispatch_queue_, explain_type_, g_enable_calcite_view_optimize, g_enable_filter_push_down, g_enable_watchdog, Executor::getExecutor(), CompilationOptions::hoist_literals, Catalog_Namespace::SysCatalog::instance(), ExecutionOptions::just_explain, pg_shim(), run_benchmark_import::result, QueryRunner::anonymous_namespace{QueryRunner.cpp}::run_select_query_with_filter_push_down(), session_info_, STDLOG, and logger::thread_local_ids().
Referenced by runSelectQuery(), and runSQL().
|
virtual |
Definition at line 988 of file QueryRunner.cpp.
References defaultExecutionOptionsForRunSQL(), CompilationOptions::defaults(), and runSelectQuery().
|
virtual |
Definition at line 643 of file QueryRunner.cpp.
References CHECK, ParserWrapper::Insert, Catalog_Namespace::SysCatalog::instance(), runDDLStatement(), runSelectQuery(), and session_info_.
Referenced by runMultipleStatements(), and runSQL().
|
virtual |
Definition at line 658 of file QueryRunner.cpp.
References defaultExecutionOptionsForRunSQL(), CompilationOptions::defaults(), and runSQL().
|
virtual |
Definition at line 698 of file QueryRunner.cpp.
References calcite_lock, cat(), CHECK, create_query_state(), CompilationOptions::defaults(), dispatch_queue_, g_enable_columnar_output, g_enable_watchdog, g_gpu_mem_limit_percent, Executor::getExecutor(), Catalog_Namespace::SysCatalog::instance(), pg_shim(), run_benchmark_import::result, session_info_, STDLOG, logger::thread_local_ids(), and Executor::UNITARY_EXECUTOR_ID.
|
inline |
Definition at line 308 of file QueryRunner.h.
References explain_type_.
|
virtual |
Definition at line 488 of file QueryRunner.cpp.
References cat(), CHECK, create_query_state(), g_enable_watchdog, pg_shim(), session_info_, and STDLOG.
|
protected |
Definition at line 330 of file QueryRunner.h.
Referenced by getBufferPoolStats(), and QueryRunner().
|
protected |
Definition at line 332 of file QueryRunner.h.
Referenced by getCalcitePlan(), getRelAlgDag(), resizeDispatchQueue(), runSelectQuery(), and runSQLWithAllowingInterrupt().
|
protected |
Definition at line 328 of file QueryRunner.h.
Referenced by runSelectQuery(), and setExplainType().
|
staticprotected |
Definition at line 326 of file QueryRunner.h.
|
protected |
Definition at line 333 of file QueryRunner.h.
Referenced by QueryRunner().
|
static |
Definition at line 301 of file QueryRunner.h.
Referenced by create_query_state().
|
protected |
Definition at line 331 of file QueryRunner.h.
Referenced by addSessionId(), clearSessionId(), createStatement(), getBufferPoolStats(), getCalcitePlan(), getCatalog(), getExecutor(), getMemoryInfo(), getParsedGlobalQueryHints(), getParsedQueryHint(), getParsedQueryHints(), getQueryInfoForDataRecyclerTest(), getRaExecutionSequence(), getRelAlgDag(), getRelAlgTranslator(), getRootNodeFromParsedQuery(), getSession(), gpusPresent(), QueryRunner::ImportDriver::importGeoTable(), QueryRunner(), runDDLStatement(), runImport(), runSelectQuery(), runSQL(), runSQLWithAllowingInterrupt(), and validateDDLStatement().