41 #include "gen-cpp/CalciteServer.h"
42 #include "include/bcrypt.h"
44 #include <boost/filesystem/operations.hpp>
48 #define CALCITEPORT 3279
59 using namespace Catalog_Namespace;
66 g_calcite->close_calcite_server();
80 std::unique_ptr<QueryRunner> QueryRunner::qr_instance_ =
nullptr;
85 const std::string& udf_filename,
86 const size_t max_gpu_mem,
87 const int reserved_gpu_mem) {
102 const std::vector<LeafHostInfo>& string_servers,
103 const std::vector<LeafHostInfo>& leaf_servers) {
120 const std::string& user,
121 const std::string& pass,
122 const std::string& db_name,
123 const std::vector<LeafHostInfo>& string_servers,
124 const std::vector<LeafHostInfo>& leaf_servers,
125 const std::string& udf_filename,
127 const size_t max_gpu_mem,
128 const int reserved_gpu_mem,
130 const bool create_db,
135 LOG_IF(
FATAL, !leaf_servers.empty()) <<
"Distributed test runner not supported.";
136 CHECK(leaf_servers.empty());
150 return qr_instance_.get();
154 const std::string& user_name,
155 const std::string& passwd,
156 const std::string& db_name,
157 const std::vector<LeafHostInfo>& string_servers,
158 const std::vector<LeafHostInfo>& leaf_servers,
159 const std::string& udf_filename,
161 const size_t max_gpu_mem,
162 const int reserved_gpu_mem,
164 const bool create_db,
168 boost::filesystem::path base_path{db_path};
169 CHECK(boost::filesystem::exists(base_path));
170 auto system_db_file =
172 CHECK(boost::filesystem::exists(system_db_file));
178 disk_cache_config = *cache_config;
185 std::make_shared<Calcite>(-1,
CALCITEPORT, db_path, 1024, 5000,
true, udf_filename);
187 if (!udf_filename.empty()) {
194 std::vector<TUserDefinedFunction> udfs = {};
195 g_calcite->setRuntimeExtensionFunctions(udfs, udtfs,
false);
197 std::unique_ptr<CudaMgr_Namespace::CudaMgr> cuda_mgr;
200 cuda_mgr = std::make_unique<CudaMgr_Namespace::CudaMgr>(-1, 0);
207 mapd_params.
aggregator = !leaf_servers.empty();
213 if (!sys_cat.isInitialized()) {
214 auto data_mgr = std::make_shared<Data_Namespace::DataMgr>(data_dir.string(),
234 if (!sys_cat.getMetadataForUser(user_name, user)) {
238 passwd,
false,
"",
true},
242 CHECK(sys_cat.getMetadataForUser(user_name, user));
247 sys_cat.createDatabase(db_name, user.
userId);
254 session_info_ = std::make_unique<Catalog_Namespace::SessionInfo>(
258 void QueryRunner::resizeDispatchQueue(
const size_t num_executors) {
263 : session_info_(std::move(session))
266 std::shared_ptr<Catalog_Namespace::Catalog> QueryRunner::getCatalog()
const {
271 std::shared_ptr<Calcite> QueryRunner::getCalcite()
const {
276 bool QueryRunner::gpusPresent()
const {
278 return session_info_->getCatalog().getDataMgr().gpusPresent();
281 void QueryRunner::clearGpuMemory()
const {
286 void QueryRunner::clearCpuMemory()
const {
291 std::vector<MemoryInfo> QueryRunner::getMemoryInfo(
294 return session_info_->getCatalog().getDataMgr().getMemoryInfo(memory_level);
299 const bool current_db_only)
const {
302 const std::vector<MemoryInfo> memory_infos =
303 session_info_->getCatalog().getDataMgr().getMemoryInfo(memory_level);
305 CHECK_EQ(memory_infos.size(),
static_cast<size_t>(1));
307 std::set<std::vector<int32_t>> chunk_keys;
308 std::set<std::vector<int32_t>> table_keys;
309 std::set<std::vector<int32_t>> column_keys;
310 std::set<std::vector<int32_t>> fragment_keys;
311 size_t total_num_buffers{
313 size_t total_num_bytes{0};
314 for (
auto& pool_memory_info : memory_infos) {
315 const std::vector<MemoryData>& memory_data = pool_memory_info.nodeMemoryData;
316 for (
auto& memory_datum : memory_data) {
318 const auto& chunk_key = memory_datum.chunk_key;
320 chunk_key.size() < 4) {
323 if (current_db_only) {
328 total_num_bytes += (memory_datum.numPages * pool_memory_info.pageSize);
329 table_keys.insert({chunk_key[0], chunk_key[1]});
330 column_keys.insert({chunk_key[0], chunk_key[1], chunk_key[2]});
331 fragment_keys.insert({chunk_key[0], chunk_key[1], chunk_key[3]});
332 chunk_keys.insert(chunk_key);
335 return {total_num_buffers,
339 fragment_keys.size(),
350 auto calcite_mgr =
cat.getCalciteMgr();
351 const auto calciteQueryParsingOption =
352 calcite_mgr->getCalciteQueryParsingOption(
true,
false,
true);
353 const auto calciteOptimizationOption =
355 const auto query_ra = calcite_mgr
356 ->process(query_state->createQueryStateProxy(),
358 calciteQueryParsingOption,
359 calciteOptimizationOption)
361 auto ra_executor =
RelAlgExecutor(executor.get(), query_ra, query_state);
367 std::shared_ptr<const RelAlgNode> QueryRunner::getRootNodeFromParsedQuery(
368 const std::string& query_str) {
375 auto calcite_mgr =
cat.getCalciteMgr();
376 const auto calciteQueryParsingOption =
377 calcite_mgr->getCalciteQueryParsingOption(
true,
false,
true);
378 const auto calciteOptimizationOption =
380 const auto query_ra = calcite_mgr
381 ->process(query_state->createQueryStateProxy(),
383 calciteQueryParsingOption,
384 calciteOptimizationOption)
386 auto ra_executor =
RelAlgExecutor(executor.get(), query_ra, query_state);
391 std::unordered_map<size_t, std::unordered_map<unsigned, RegisteredQueryHint>>>
392 QueryRunner::getParsedQueryHints(
const std::string& query_str) {
398 auto calcite_mgr =
cat.getCalciteMgr();
399 const auto calciteQueryParsingOption =
400 calcite_mgr->getCalciteQueryParsingOption(
true,
false,
true);
401 const auto calciteOptimizationOption =
403 const auto query_ra = calcite_mgr
404 ->process(query_state->createQueryStateProxy(),
406 calciteQueryParsingOption,
407 calciteOptimizationOption)
409 auto ra_executor =
RelAlgExecutor(executor.get(), query_ra, query_state);
413 std::optional<RegisteredQueryHint> QueryRunner::getParsedGlobalQueryHints(
414 const std::string& query_str) {
420 auto calcite_mgr =
cat.getCalciteMgr();
421 const auto calciteQueryParsingOption =
422 calcite_mgr->getCalciteQueryParsingOption(
true,
false,
true);
423 const auto calciteOptimizationOption =
425 const auto query_ra = calcite_mgr
426 ->process(query_state->createQueryStateProxy(),
428 calciteQueryParsingOption,
429 calciteOptimizationOption)
431 auto ra_executor =
RelAlgExecutor(executor.get(), query_ra, query_state);
441 auto calcite_mgr =
cat.getCalciteMgr();
442 const auto calciteQueryParsingOption =
443 calcite_mgr->getCalciteQueryParsingOption(
true,
false,
true);
444 const auto calciteOptimizationOption =
446 const auto query_ra = calcite_mgr
447 ->process(query_state->createQueryStateProxy(),
449 calciteQueryParsingOption,
450 calciteOptimizationOption)
452 auto ra_executor =
RelAlgExecutor(executor.get(), query_ra, query_state);
458 void QueryRunner::validateDDLStatement(
const std::string& stmt_str_in) {
461 std::string stmt_str = stmt_str_in;
463 boost::algorithm::trim_left_if(stmt_str, boost::algorithm::is_any_of(
"\n"));
465 boost::algorithm::trim_left(stmt_str);
468 auto stdlog =
STDLOG(query_state);
471 auto calcite_mgr =
cat.getCalciteMgr();
472 const auto calciteQueryParsingOption =
473 calcite_mgr->getCalciteQueryParsingOption(
true,
false,
true);
474 const auto calciteOptimizationOption =
476 calcite_mgr->process(query_state->createQueryStateProxy(),
478 calciteQueryParsingOption,
479 calciteOptimizationOption);
482 std::shared_ptr<RelAlgTranslator> QueryRunner::getRelAlgTranslator(
483 const std::string& query_str,
484 Executor* executor) {
489 auto calcite_mgr =
cat.getCalciteMgr();
490 const auto calciteQueryParsingOption =
491 calcite_mgr->getCalciteQueryParsingOption(
true,
false,
true);
492 const auto calciteOptimizationOption =
494 const auto query_ra = calcite_mgr
495 ->process(query_state->createQueryStateProxy(),
497 calciteQueryParsingOption,
498 calciteOptimizationOption)
501 auto root_node_shared_ptr = ra_executor.getRootRelAlgNodeShPtr();
502 return ra_executor.getRelAlgTranslator(root_node_shared_ptr.get());
506 const std::string& query_str) {
512 auto calcite_mgr =
cat.getCalciteMgr();
513 const auto calciteQueryParsingOption =
514 calcite_mgr->getCalciteQueryParsingOption(
true,
false,
true);
515 const auto calciteOptimizationOption =
517 const auto query_ra = calcite_mgr
518 ->process(query_state->createQueryStateProxy(),
520 calciteQueryParsingOption,
521 calciteOptimizationOption)
528 auto join_info = ra_executor.getJoinInfo(root_node_shared_ptr.get());
529 auto relAlgTranslator = ra_executor.getRelAlgTranslator(root_node_shared_ptr.get());
530 return {root_node_shared_ptr, join_info.first, join_info.second, relAlgTranslator};
533 std::unique_ptr<Parser::Stmt> QueryRunner::createStatement(
534 const std::string& stmt_str_in) {
538 std::string stmt_str = stmt_str_in;
540 boost::algorithm::trim_left_if(stmt_str, boost::algorithm::is_any_of(
"\n"));
542 boost::algorithm::trim_left(stmt_str);
547 auto stdlog =
STDLOG(query_state);
551 auto calcite_mgr =
cat.getCalciteMgr();
552 const auto calciteQueryParsingOption =
553 calcite_mgr->getCalciteQueryParsingOption(
true,
false,
true);
554 const auto calciteOptimizationOption =
556 const auto query_json = calcite_mgr
557 ->process(query_state->createQueryStateProxy(),
559 calciteQueryParsingOption,
560 calciteOptimizationOption)
570 void QueryRunner::runDDLStatement(
const std::string& stmt_str_in) {
574 std::string stmt_str = stmt_str_in;
576 boost::algorithm::trim_left_if(stmt_str, boost::algorithm::is_any_of(
"\n"));
578 boost::algorithm::trim_left(stmt_str);
583 auto stdlog =
STDLOG(query_state);
587 auto calcite_mgr =
cat.getCalciteMgr();
588 const auto calciteQueryParsingOption =
589 calcite_mgr->getCalciteQueryParsingOption(
true,
false,
true);
590 const auto calciteOptimizationOption =
592 const auto query_ra = calcite_mgr
593 ->process(query_state->createQueryStateProxy(),
595 calciteQueryParsingOption,
596 calciteOptimizationOption)
599 rapidjson::Document ddl_query;
600 ddl_query.Parse(query_ra);
601 CHECK(ddl_query.HasMember(
"payload"));
602 CHECK(ddl_query[
"payload"].IsObject());
613 std::shared_ptr<ResultSet> QueryRunner::runSQL(
const std::string& query_str,
624 const auto execution_result =
runSelectQuery(query_str, std::move(co), std::move(eo));
626 return execution_result->getRows();
629 std::shared_ptr<ResultSet> QueryRunner::runSQL(
const std::string& query_str,
631 const bool hoist_literals,
632 const bool allow_loop_joins) {
634 co.hoist_literals = hoist_literals;
659 std::shared_ptr<Executor> QueryRunner::getExecutor()
const {
663 auto stdlog =
STDLOG(query_state);
668 std::shared_ptr<ResultSet> QueryRunner::runSQLWithAllowingInterrupt(
669 const std::string& query_str,
670 const std::string& session_id,
672 const double running_query_check_freq,
673 const unsigned pending_query_check_freq) {
677 auto session_info = std::make_shared<Catalog_Namespace::SessionInfo>(
678 session_info_->get_catalog_ptr(), current_user, device_type, session_id);
680 auto stdlog =
STDLOG(query_state);
681 auto&
cat = query_state->getConstSessionInfo()->getCatalog();
682 std::string query_ra{
""};
684 std::shared_ptr<ExecutionResult>
result;
685 auto query_launch_task = std::make_shared<QueryDispatchQueue::Task>(
691 &running_query_check_freq,
692 &pending_query_check_freq,
712 running_query_check_freq,
713 pending_query_check_freq,
720 std::lock_guard<std::mutex> calcite_lock_guard(
calcite_lock);
721 auto calcite_mgr = cat.getCalciteMgr();
722 const auto calciteQueryParsingOption =
723 calcite_mgr->getCalciteQueryParsingOption(
true,
false,
true);
724 const auto calciteOptimizationOption =
725 calcite_mgr->getCalciteOptimizationOption(
727 query_ra = calcite_mgr
728 ->process(query_state->createQueryStateProxy(),
729 pg_shim(query_state->getQueryStr()),
730 calciteQueryParsingOption,
731 calciteOptimizationOption)
734 auto ra_executor =
RelAlgExecutor(executor.get(), query_ra, query_state);
735 result = std::make_shared<ExecutionResult>(
736 ra_executor.executeRelAlgQuery(co, eo,
false,
nullptr));
739 executor->enrollQuerySession(session_id,
741 query_state->getQuerySubmittedTime(),
743 QuerySessionStatus::QueryStatus::PENDING_QUEUE);
746 auto result_future = query_launch_task->get_future();
749 return result->getRows();
752 std::vector<std::shared_ptr<ResultSet>> QueryRunner::runMultipleStatements(
753 const std::string& sql,
755 std::vector<std::shared_ptr<ResultSet>> results;
757 auto fields =
split(sql,
";");
758 for (
const auto&
field : fields) {
767 results.push_back(
nullptr);
770 results.push_back(
runSQL(text, dt,
true,
true));
781 std::unique_ptr<import_export::Loader> QueryRunner::getLoader(
784 return std::make_unique<import_export::Loader>(*
cat, td);
792 const bool hoist_literals,
793 const bool allow_loop_joins,
794 const bool just_explain,
796 const bool with_filter_push_down) {
809 auto calcite_mgr =
cat.getCalciteMgr();
810 const auto calciteQueryParsingOption =
811 calcite_mgr->getCalciteQueryParsingOption(
true,
false,
true);
812 auto calciteOptimizationOption =
814 const auto query_ra = calcite_mgr
815 ->process(query_state_proxy,
817 calciteQueryParsingOption,
818 calciteOptimizationOption)
821 auto result = std::make_shared<ExecutionResult>(
822 ra_executor.executeRelAlgQuery(co, eo,
false,
nullptr));
823 const auto& filter_push_down_requests = result->getPushedDownFilterInfo();
824 if (!filter_push_down_requests.empty()) {
825 std::vector<TFilterPushDownInfo> filter_push_down_info;
826 for (
const auto& req : filter_push_down_requests) {
827 TFilterPushDownInfo filter_push_down_info_for_request;
828 filter_push_down_info_for_request.input_prev = req.input_prev;
829 filter_push_down_info_for_request.input_start = req.input_start;
830 filter_push_down_info_for_request.input_next = req.input_next;
831 filter_push_down_info.push_back(filter_push_down_info_for_request);
833 calciteOptimizationOption.filter_push_down_info = filter_push_down_info;
834 const auto new_query_ra = calcite_mgr
835 ->process(query_state_proxy,
837 calciteQueryParsingOption,
838 calciteOptimizationOption)
840 auto eo_modified = eo;
842 eo_modified.just_calcite_explain =
false;
843 auto new_ra_executor =
RelAlgExecutor(executor.get(), new_query_ra);
844 return std::make_shared<ExecutionResult>(
845 new_ra_executor.executeRelAlgQuery(co, eo_modified,
false,
nullptr));
853 std::shared_ptr<ResultSet> QueryRunner::getCalcitePlan(
const std::string& query_str,
854 bool enable_watchdog,
855 bool as_json_str)
const {
860 auto stdlog =
STDLOG(query_state);
862 std::shared_ptr<ResultSet>
result;
863 auto query_launch_task = std::make_shared<QueryDispatchQueue::Task>(
873 auto calcite_mgr = cat.getCalciteMgr();
874 const auto calciteQueryParsingOption =
875 calcite_mgr->getCalciteQueryParsingOption(
true, as_json_str,
false);
876 const auto calciteOptimizationOption = calcite_mgr->getCalciteOptimizationOption(
878 const auto query_ra = calcite_mgr
879 ->process(query_state->createQueryStateProxy(),
881 calciteQueryParsingOption,
882 calciteOptimizationOption)
884 result = std::make_shared<ResultSet>(query_ra);
889 auto result_future = query_launch_task->get_future();
895 std::shared_ptr<ExecutionResult> QueryRunner::runSelectQuery(
const std::string& query_str,
901 auto stdlog =
STDLOG(query_state);
914 std::shared_ptr<ExecutionResult>
result;
915 auto query_launch_task = std::make_shared<QueryDispatchQueue::Task>(
930 co.explain_type = explain_type;
931 auto calcite_mgr = cat.getCalciteMgr();
932 const auto calciteQueryParsingOption =
933 calcite_mgr->getCalciteQueryParsingOption(
true,
false,
true);
934 const auto calciteOptimizationOption = calcite_mgr->getCalciteOptimizationOption(
936 const auto query_ra = calcite_mgr
937 ->process(query_state->createQueryStateProxy(),
939 calciteQueryParsingOption,
940 calciteOptimizationOption)
943 result = std::make_shared<ExecutionResult>(
944 ra_executor.executeRelAlgQuery(co, eo,
false,
nullptr));
948 auto result_future = query_launch_task->get_future();
954 std::shared_ptr<ExecutionResult> QueryRunner::runSelectQuery(
955 const std::string& query_str,
957 const bool hoist_literals,
958 const bool allow_loop_joins,
959 const bool just_explain) {
961 co.hoist_literals = hoist_literals;
971 query_dag_info.root_node.get(), executor);
972 return extracted_dag_info;
975 std::unique_ptr<RelAlgDag> QueryRunner::getRelAlgDag(
const std::string& query_str) {
979 auto stdlog =
STDLOG(query_state);
982 std::unique_ptr<RelAlgDag> rel_alg_dag;
983 auto query_launch_task = std::make_shared<QueryDispatchQueue::Task>(
992 auto calcite_mgr = cat.getCalciteMgr();
993 const auto calciteQueryParsingOption =
994 calcite_mgr->getCalciteQueryParsingOption(
true,
false,
true);
995 const auto calciteOptimizationOption = calcite_mgr->getCalciteOptimizationOption(
997 const auto query_ra = calcite_mgr
998 ->process(query_state->createQueryStateProxy(),
1000 calciteQueryParsingOption,
1001 calciteOptimizationOption)
1008 auto result_future = query_launch_task->get_future();
1009 result_future.get();
1025 std::shared_ptr<HashTable>,
1026 std::optional<HashtableCacheMetaInfo>>
1027 QueryRunner::getCachedHashtableWithoutCacheKey(std::set<size_t>& visited,
1031 switch (hash_table_type) {
1049 CHECK(hash_table_cache);
1050 return hash_table_cache->getCachedHashtableWithoutCacheKey(
1051 visited, hash_table_type, device_identifier);
1054 std::shared_ptr<CacheItemMetric> QueryRunner::getCacheItemMetric(
1059 switch (hash_table_type) {
1077 CHECK(hash_table_cache);
1078 return hash_table_cache->getCachedItemMetric(
1079 hash_table_type, device_identifier, cache_key);
1084 bool with_overlaps_tuning_param)
const {
1085 auto get_num_cached_auto_tuner_param = [&item_status]() {
1087 CHECK(auto_tuner_cache);
1088 switch (item_status) {
1090 return auto_tuner_cache->getCurrentNumCachedItems(
1095 return auto_tuner_cache->getCurrentNumCleanCachedItems(
1100 return auto_tuner_cache->getCurrentNumDirtyCachedItems(
1106 return static_cast<size_t>(0);
1111 auto get_num_cached_hashtable =
1114 &with_overlaps_tuning_param,
1116 switch (item_status) {
1118 if (with_overlaps_tuning_param) {
1122 return hash_table_cache->getCurrentNumCachedItems(
1124 get_num_cached_auto_tuner_param();
1126 return hash_table_cache->getCurrentNumCachedItems(
1130 if (with_overlaps_tuning_param) {
1132 return hash_table_cache->getCurrentNumCleanCachedItems(
1134 get_num_cached_auto_tuner_param();
1136 return hash_table_cache->getCurrentNumCleanCachedItems(
1140 if (with_overlaps_tuning_param) {
1142 return hash_table_cache->getCurrentNumDirtyCachedItems(
1144 get_num_cached_auto_tuner_param();
1146 return hash_table_cache->getCurrentNumDirtyCachedItems(
1151 return static_cast<size_t>(0);
1156 switch (hash_table_type) {
1159 CHECK(hash_table_cache);
1160 return get_num_cached_hashtable(hash_table_cache);
1164 CHECK(hash_table_cache);
1165 return get_num_cached_hashtable(hash_table_cache);
1169 CHECK(hash_table_cache);
1170 return get_num_cached_hashtable(hash_table_cache);
1173 return get_num_cached_auto_tuner_param();
1183 void QueryRunner::reset() {
1192 const std::string session_id)
1194 std::make_unique<Catalog_Namespace::
SessionInfo>(cat, user, dt, session_id)) {}
1197 const std::string& table_name,
1198 const bool compression,
1200 const bool explode_collections) {
1201 using namespace import_export;
1203 static constexpr
bool kIsGeoRaster{
false};
1211 copy_params.geo_coords_comp_param = 32;
1214 copy_params.geo_coords_comp_param = 0;
1216 copy_params.geo_assign_render_groups =
false;
1217 copy_params.geo_explode_collections = explode_collections;
1219 std::map<std::string, std::string> colname_to_src;
1221 auto cds = Importer::gdalToColumnDescriptors(
1224 for (
auto& cd : cds) {
1227 colname_to_src.insert(std::make_pair(col_name_sanitized, cd.columnName));
1229 cd.columnName = col_name_sanitized;
1233 const auto td =
cat.getMetadataForTable(table_name);
1234 if (td !=
nullptr) {
1235 throw std::runtime_error(
1236 "Error: Table " + table_name +
1237 " already exists. Possible failure to correctly re-create " +
1241 throw std::runtime_error(
"Invalid characters in table name: " + table_name);
1244 std::string stmt{
"CREATE TABLE " + table_name};
1245 std::vector<std::string> col_stmts;
1247 for (
auto& cd : cds) {
1250 throw std::runtime_error(
1251 "Unsupported type: INTERVAL_DAY_TIME or INTERVAL_YEAR_MONTH for col " +
1252 cd.columnName +
" (table: " + table_name +
")");
1256 if (cd.columnType.get_precision() == 0 && cd.columnType.get_scale() == 0) {
1257 cd.columnType.set_precision(14);
1258 cd.columnType.set_scale(7);
1262 std::string col_stmt;
1263 col_stmt.append(cd.columnName +
" " + cd.columnType.get_type_name() +
" ");
1266 col_stmt.append(
"ENCODING " + cd.columnType.get_compression_name() +
" ");
1268 if (cd.columnType.is_string()) {
1269 col_stmt.append(
"ENCODING NONE");
1270 }
else if (cd.columnType.is_geometry()) {
1271 if (cd.columnType.get_output_srid() == 4326) {
1272 col_stmt.append(
"ENCODING NONE");
1276 col_stmts.push_back(col_stmt);
1282 LOG(
INFO) <<
"Created table: " << table_name;
1284 LOG(
INFO) <<
"Not creating table: " << table_name;
1287 const auto td =
cat.getMetadataForTable(table_name);
1288 if (td ==
nullptr) {
1289 throw std::runtime_error(
"Error: Failed to create table " + table_name);
1295 LOG(
INFO) <<
"Import Time for " << table_name <<
": " << (double)ms / 1000.0 <<
" s";
bool g_enable_calcite_view_optimize
Classes used to wrap parser calls for calcite redirection.
static void addUdfs(const std::string &json_func_sigs)
ImportStatus importGDAL(const std::map< std::string, std::string > &colname_to_src, const Catalog_Namespace::SessionInfo *session_info, const bool is_raster)
const std::string kDataDirectoryName
static std::vector< TableFunction > get_table_funcs()
bool find_push_down_candidates
std::unique_ptr< QueryDispatchQueue > dispatch_queue_
static TimeT::rep execution(F func, Args &&...args)
std::string const & getQueryStr() const
static void initialize(const std::string &data_dir, const std::string &allowed_import_paths, const std::string &allowed_export_paths)
const std::string kDefaultDiskCacheDirName
ImportDriver(std::shared_ptr< Catalog_Namespace::Catalog > cat, const Catalog_Namespace::UserMetadata &user, const ExecutorDeviceType dt=ExecutorDeviceType::GPU, const std::string session_id="")
ExecutorExplainType explain_type_
static void add(const std::string &json_func_sigs)
static HashtableRecycler * getHashTableCache()
std::optional< std::unordered_map< size_t, std::unordered_map< unsigned, RegisteredQueryHint > > > getParsedQueryHints()
std::optional< RegisteredQueryHint > getParsedQueryHint(const RelAlgNode *node)
void set_once_fatal_func(FatalFunc fatal_func)
Catalog_Namespace::DBMetadata db_metadata_
static ExecutionOptions defaultExecutionOptionsForRunSQL(bool allow_loop_joins=true, bool just_explain=false)
virtual std::shared_ptr< ResultSet > runSQL(const std::string &query_str, CompilationOptions co, ExecutionOptions eo)
const std::string kGeoColumnName
#define LOG_IF(severity, condition)
static void clearMemory(const Data_Namespace::MemoryLevel memory_level)
void calcite_shutdown_handler() noexcept
static void addShutdownCallback(std::function< void()> shutdown_callback)
std::shared_ptr< const RelAlgNode > getRootRelAlgNodeShPtr() const
static std::shared_ptr< Executor > getExecutor(const ExecutorId id, const std::string &debug_dir="", const std::string &debug_file="", const SystemParameters &system_parameters=SystemParameters())
std::shared_ptr< QueryEngine > query_engine_
This file contains the class specification and related data structures for Catalog.
bool output_columnar_hint
RaExecutionSequence getRaExecutionSequence(const RelAlgNode *root_node, Executor *executor)
const rapidjson::Value & field(const rapidjson::Value &obj, const char field[]) noexcept
bool g_enable_columnar_output
Supported runtime functions management and retrieval.
static SysCatalog & instance()
void execute(const Catalog_Namespace::SessionInfo &session, bool read_only_mode) override
Classes representing a parse tree.
const std::string kDefaultDbName
void init(LogOptions const &log_opts)
std::unique_ptr< Parser::Stmt > create_stmt_for_json(const std::string &query_json)
static HashtableRecycler * getHashTableCache()
static std::shared_ptr< QueryEngine > createInstance(CudaMgr_Namespace::CudaMgr *cuda_mgr, bool cpu_only)
A container for relational algebra descriptors defining the execution order for a relational algebra ...
ExecutorExplainType explain_type
static void registerSignalHandler()
virtual void runDDLStatement(const std::string &)
static std::unique_ptr< QueryRunner > qr_instance_
double g_gpu_mem_limit_percent
import_export::SourceType source_type
static OverlapsTuningParamRecycler * getOverlapsTuningParamCache()
bool g_serialize_temp_tables
ExecutorDeviceType device_type
std::optional< RegisteredQueryHint > getGlobalQueryHint()
void importGeoTable(const std::string &file_path, const std::string &table_name, const bool compression, const bool create_table, const bool explode_collections)
const std::string kRootUsername
static RegisteredQueryHint defaults()
TExtArgumentType::type to_thrift(const ExtArgumentType &t)
std::shared_ptr< ExecutionResult > run_select_query_with_filter_push_down(QueryStateProxy query_state_proxy, const ExecutorDeviceType device_type, const bool hoist_literals, const bool allow_loop_joins, const bool just_explain, const ExecutorExplainType explain_type, const bool with_filter_push_down)
ExecutionResult execute(bool read_only_mode)
std::string sanitize_name(const std::string &name, const bool underscore=false)
std::shared_ptr< Catalog_Namespace::SessionInfo > session_info_
virtual std::shared_ptr< ExecutionResult > runSelectQuery(const std::string &query_str, CompilationOptions co, ExecutionOptions eo)
std::shared_ptr< Calcite > g_calcite
const std::string kCatalogDirectoryName
static std::shared_ptr< query_state::QueryState > create_query_state(Ts &&...args)
static CompilationOptions defaults(const ExecutorDeviceType device_type=ExecutorDeviceType::GPU)
bool g_enable_filter_push_down
QueryPlanDagInfo getQueryInfoForDataRecyclerTest(const std::string &)
static HashtableRecycler * getHashTableCache()
size_t gpu_buffer_mem_bytes
double gpu_input_mem_limit_percent
Serializers for query engine types to/from thrift.
std::shared_ptr< Catalog_Namespace::Catalog > getCatalog() const
void setup_signal_handler()
std::unique_ptr< RelAlgDag > getOwnedRelAlgDag()
static constexpr DeviceIdentifier CPU_DEVICE_IDENTIFIER
static ExecutionOptions defaults()
std::shared_ptr< Catalog_Namespace::SessionInfo const > getConstSessionInfo() const
std::string pg_shim(const std::string &query)
ThreadLocalIds thread_local_ids()
static const ExecutorId UNITARY_EXECUTOR_ID