OmniSciDB  eee9fa949c
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Execute.h
Go to the documentation of this file.
1 /*
2  * Copyright 2017 MapD Technologies, Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef QUERYENGINE_EXECUTE_H
18 #define QUERYENGINE_EXECUTE_H
19 
20 #include "AggregatedColRange.h"
21 #include "BufferCompaction.h"
22 #include "CartesianProduct.h"
23 #include "CgenState.h"
24 #include "CodeCache.h"
25 #include "DateTimeUtils.h"
27 #include "GroupByAndAggregate.h"
28 #include "JoinHashTable.h"
30 #include "NvidiaKernel.h"
31 #include "PlanState.h"
32 #include "RelAlgExecutionUnit.h"
33 #include "RelAlgTranslator.h"
35 #include "TableGenerations.h"
36 #include "TargetMetaInfo.h"
37 #include "WindowContext.h"
38 
39 #include "../Chunk/Chunk.h"
40 #include "../Fragmenter/InsertOrderFragmenter.h"
41 #include "../Planner/Planner.h"
42 #include "../Shared/Logger.h"
43 #include "../Shared/MapDParameters.h"
44 #include "../Shared/measure.h"
45 #include "../Shared/thread_count.h"
46 #include "../StringDictionary/LruCache.hpp"
47 #include "../StringDictionary/StringDictionary.h"
48 #include "../StringDictionary/StringDictionaryProxy.h"
49 
50 #include <llvm/IR/Function.h>
51 #include <llvm/IR/Value.h>
52 #include <llvm/Linker/Linker.h>
53 #include <llvm/Transforms/Utils/ValueMapper.h>
54 #include <rapidjson/document.h>
55 
56 #include <algorithm>
57 #include <condition_variable>
58 #include <cstddef>
59 #include <cstdlib>
60 #include <deque>
61 #include <functional>
62 #include <limits>
63 #include <map>
64 #include <mutex>
65 #include <stack>
66 #include <unordered_map>
67 #include <unordered_set>
68 
69 extern bool g_enable_watchdog;
70 extern bool g_enable_dynamic_watchdog;
71 extern unsigned g_dynamic_watchdog_time_limit;
72 extern unsigned g_trivial_loop_join_threshold;
73 extern bool g_from_table_reordering;
74 extern bool g_enable_filter_push_down;
75 extern bool g_allow_cpu_retry;
76 extern bool g_null_div_by_zero;
77 extern bool g_bigint_count;
79 extern float g_filter_push_down_low_frac;
80 extern float g_filter_push_down_high_frac;
82 extern bool g_enable_columnar_output;
83 extern bool g_enable_overlaps_hashjoin;
85 extern bool g_strip_join_covered_quals;
86 extern size_t g_constrained_by_in_threshold;
87 extern size_t g_big_group_threshold;
88 extern bool g_enable_window_functions;
89 extern bool g_enable_table_functions;
90 extern size_t g_max_memory_allocation_size;
93 
95 using QueryCompilationDescriptorOwned = std::unique_ptr<QueryCompilationDescriptor>;
97 using QueryMemoryDescriptorOwned = std::unique_ptr<QueryMemoryDescriptor>;
98 
99 extern void read_udf_gpu_module(const std::string& udf_ir_filename);
100 extern void read_udf_cpu_module(const std::string& udf_ir_filename);
101 extern bool is_udf_module_present(bool cpu_only = false);
102 extern void read_rt_udf_gpu_module(const std::string& udf_ir);
103 extern void read_rt_udf_cpu_module(const std::string& udf_ir);
104 extern bool is_rt_udf_module_present(bool cpu_only = false);
105 
106 class ColumnFetcher;
107 class ExecutionResult;
108 
109 class WatchdogException : public std::runtime_error {
110  public:
111  WatchdogException(const std::string& cause) : std::runtime_error(cause) {}
112 };
113 
114 class Executor;
115 
116 inline llvm::Value* get_arg_by_name(llvm::Function* func, const std::string& name) {
117  for (auto& arg : func->args()) {
118  if (arg.getName() == name) {
119  return &arg;
120  }
121  }
122  CHECK(false);
123  return nullptr;
124 }
125 
126 inline uint32_t log2_bytes(const uint32_t bytes) {
127  switch (bytes) {
128  case 1:
129  return 0;
130  case 2:
131  return 1;
132  case 4:
133  return 2;
134  case 8:
135  return 3;
136  default:
137  abort();
138  }
139 }
140 
142  const int col_id,
143  const int table_id,
144  const Catalog_Namespace::Catalog& cat) {
145  CHECK_GT(table_id, 0);
146  const auto col_desc = cat.getMetadataForColumn(table_id, col_id);
147  CHECK(col_desc);
148  return col_desc;
149 }
150 
151 inline const Analyzer::Expr* extract_cast_arg(const Analyzer::Expr* expr) {
152  const auto cast_expr = dynamic_cast<const Analyzer::UOper*>(expr);
153  if (!cast_expr || cast_expr->get_optype() != kCAST) {
154  return expr;
155  }
156  return cast_expr->get_operand();
157 }
158 
159 inline std::string numeric_type_name(const SQLTypeInfo& ti) {
160  CHECK(ti.is_integer() || ti.is_decimal() || ti.is_boolean() || ti.is_time() ||
161  ti.is_fp() || (ti.is_string() && ti.get_compression() == kENCODING_DICT) ||
162  ti.is_timeinterval());
163  if (ti.is_integer() || ti.is_decimal() || ti.is_boolean() || ti.is_time() ||
164  ti.is_string() || ti.is_timeinterval()) {
165  return "int" + std::to_string(ti.get_logical_size() * 8) + "_t";
166  }
167  return ti.get_type() == kDOUBLE ? "double" : "float";
168 }
169 
171  const int col_id,
172  const int table_id,
173  const Catalog_Namespace::Catalog& cat) {
174  CHECK(table_id);
175  return table_id > 0 ? get_column_descriptor(col_id, table_id, cat) : nullptr;
176 }
177 
178 inline const ResultSetPtr& get_temporary_table(const TemporaryTables* temporary_tables,
179  const int table_id) {
180  CHECK_LT(table_id, 0);
181  const auto it = temporary_tables->find(table_id);
182  CHECK(it != temporary_tables->end());
183  return it->second;
184 }
185 
186 inline const SQLTypeInfo get_column_type(const int col_id,
187  const int table_id,
188  const ColumnDescriptor* cd,
189  const TemporaryTables* temporary_tables) {
190  CHECK(cd || temporary_tables);
191  if (cd) {
192  CHECK_EQ(col_id, cd->columnId);
193  CHECK_EQ(table_id, cd->tableId);
194  return cd->columnType;
195  }
196  const auto& temp = get_temporary_table(temporary_tables, table_id);
197  return temp->getColType(col_id);
198 }
199 
200 template <typename PtrTy>
202  std::shared_ptr<RowSetMemoryOwner> row_set_mem_owner,
203  const PtrTy& result,
204  const int number) {
205  std::vector<SQLTypeInfo> col_types;
206  for (size_t i = 0; i < result->colCount(); ++i) {
207  col_types.push_back(get_logical_type_info(result->getColType(i)));
208  }
209  return new ColumnarResults(row_set_mem_owner, *result, number, col_types);
210 }
211 
212 // TODO(alex): Adjust interfaces downstream and make this not needed.
213 inline std::vector<Analyzer::Expr*> get_exprs_not_owned(
214  const std::vector<std::shared_ptr<Analyzer::Expr>>& exprs) {
215  std::vector<Analyzer::Expr*> exprs_not_owned;
216  for (const auto expr : exprs) {
217  exprs_not_owned.push_back(expr.get());
218  }
219  return exprs_not_owned;
220 }
221 
223  std::shared_ptr<RowSetMemoryOwner> row_set_mem_owner,
224  const ResultSetPtr& result,
225  const int frag_id) {
227  CHECK_EQ(0, frag_id);
228  return rows_to_columnar_results(row_set_mem_owner, result, result->colCount());
229 }
230 
231 class CompilationRetryNoLazyFetch : public std::runtime_error {
232  public:
234  : std::runtime_error("Retry query compilation with no GPU lazy fetch.") {}
235 };
236 
237 class CompilationRetryNewScanLimit : public std::runtime_error {
238  public:
239  CompilationRetryNewScanLimit(const size_t new_scan_limit)
240  : std::runtime_error("Retry query compilation with new scan limit.")
241  , new_scan_limit_(new_scan_limit) {}
242 
244 };
245 
246 class TooManyLiterals : public std::runtime_error {
247  public:
248  TooManyLiterals() : std::runtime_error("Too many literals in the query") {}
249 };
250 
251 class CompilationRetryNoCompaction : public std::runtime_error {
252  public:
254  : std::runtime_error("Retry query compilation with no compaction.") {}
255 };
256 
257 class QueryMustRunOnCpu : public std::runtime_error {
258  public:
259  QueryMustRunOnCpu() : std::runtime_error("Query must run in cpu mode.") {}
260 };
261 
262 class SringConstInResultSet : public std::runtime_error {
263  public:
265  : std::runtime_error(
266  "NONE ENCODED String types are not supported as input result set.") {}
267 };
268 
269 class ExtensionFunction;
270 
271 namespace std {
272 template <>
273 struct hash<std::vector<int>> {
274  size_t operator()(const std::vector<int>& vec) const {
275  return vec.size() ^ boost::hash_range(vec.begin(), vec.end());
276  }
277 };
278 
279 template <>
280 struct hash<std::pair<int, int>> {
281  size_t operator()(const std::pair<int, int>& p) const {
282  return boost::hash<std::pair<int, int>>()(p);
283  }
284 };
285 
286 } // namespace std
287 
289 
291  public:
293 
294  UpdateLogForFragment(FragmentInfoType const& fragment_info,
295  size_t const,
296  const std::shared_ptr<ResultSet>& rs);
297 
298  std::vector<TargetValue> getEntryAt(const size_t index) const override;
299  std::vector<TargetValue> getTranslatedEntryAt(const size_t index) const override;
300 
301  size_t const getRowCount() const override;
303  return rs_->getRowSetMemOwner()->getLiteralStringDictProxy();
304  }
305  size_t const getEntryCount() const override;
306  size_t const getFragmentIndex() const;
307  FragmentInfoType const& getFragmentInfo() const;
310  }
311  decltype(FragmentInfoType::fragmentId) const getFragmentId() const {
312  return fragment_info_.fragmentId;
313  }
314 
315  SQLTypeInfo getColumnType(const size_t col_idx) const;
316 
317  using Callback = std::function<void(const UpdateLogForFragment&)>;
318 
319  private:
322  std::shared_ptr<ResultSet> rs_;
323 };
324 
325 using LLVMValueVector = std::vector<llvm::Value*>;
326 
328 
329 class Executor {
330  static_assert(sizeof(float) == 4 && sizeof(double) == 8,
331  "Host hardware not supported, unexpected size of float / double.");
332  static_assert(sizeof(time_t) == 8,
333  "Host hardware not supported, 64-bit time support is required.");
334 
335  public:
336  Executor(const int db_id,
337  const size_t block_size_x,
338  const size_t grid_size_x,
339  const std::string& debug_dir,
340  const std::string& debug_file);
341 
342  static std::shared_ptr<Executor> getExecutor(
343  const int db_id,
344  const std::string& debug_dir = "",
345  const std::string& debug_file = "",
346  const MapDParameters mapd_parameters = MapDParameters());
347 
348  static void nukeCacheOfExecutors() {
349  std::lock_guard<std::mutex> flush_lock(
350  execute_mutex_); // don't want native code to vanish while executing
351  mapd_unique_lock<mapd_shared_mutex> lock(executors_cache_mutex_);
352  (decltype(executors_){}).swap(executors_);
353  }
354 
355  static void clearMemory(const Data_Namespace::MemoryLevel memory_level);
356 
357  typedef std::tuple<std::string, const Analyzer::Expr*, int64_t, const size_t> AggInfo;
358 
359  std::shared_ptr<ResultSet> execute(const Planner::RootPlan* root_plan,
360  const Catalog_Namespace::SessionInfo& session,
361  const bool hoist_literals,
362  const ExecutorDeviceType device_type,
363  const ExecutorOptLevel,
364  const bool allow_multifrag,
365  const bool allow_loop_joins,
366  RenderInfo* render_query_data = nullptr);
367 
369  const int dictId,
370  const std::shared_ptr<RowSetMemoryOwner> row_set_mem_owner,
371  const bool with_generation) const;
372 
373  bool isCPUOnly() const;
374 
375  bool isArchMaxwell(const ExecutorDeviceType dt) const;
376 
378  return cgen_state_->contains_left_deep_outer_join_;
379  }
380 
382 
384  int) const;
385 
386  const Catalog_Namespace::Catalog* getCatalog() const;
387  void setCatalog(const Catalog_Namespace::Catalog* catalog);
388 
389  const std::shared_ptr<RowSetMemoryOwner> getRowSetMemoryOwner() const;
390 
391  const TemporaryTables* getTemporaryTables() const;
392 
393  Fragmenter_Namespace::TableInfo getTableInfo(const int table_id) const;
394 
395  const TableGeneration& getTableGeneration(const int table_id) const;
396 
398 
399  size_t getNumBytesForFetchedRow() const;
400 
401  std::vector<ColumnLazyFetchInfo> getColLazyFetchInfo(
402  const std::vector<Analyzer::Expr*>& target_exprs) const;
403 
404  void registerActiveModule(void* module, const int device_id) const;
405  void unregisterActiveModule(void* module, const int device_id) const;
406  void interrupt();
407  void resetInterrupt();
408 
409  static const size_t high_scan_limit{32000000};
410 
411  int8_t warpSize() const;
412  unsigned gridSize() const;
413  unsigned blockSize() const;
414 
415  private:
416  void clearMetaInfoCache();
417 
418  int deviceCount(const ExecutorDeviceType) const;
419  int deviceCountForMemoryLevel(const Data_Namespace::MemoryLevel memory_level) const;
420 
421  // Generate code for a window function target.
422  llvm::Value* codegenWindowFunction(const size_t target_index,
423  const CompilationOptions& co);
424 
425  // Generate code for an aggregate window function target.
426  llvm::Value* codegenWindowFunctionAggregate(const CompilationOptions& co);
427 
428  // The aggregate state requires a state reset when starting a new partition. Generate
429  // the new partition check and return the continuation basic block.
430  llvm::BasicBlock* codegenWindowResetStateControlFlow();
431 
432  // Generate code for initializing the state of a window aggregate.
433  void codegenWindowFunctionStateInit(llvm::Value* aggregate_state);
434 
435  // Generates the required calls for an aggregate window function and returns the final
436  // result.
437  llvm::Value* codegenWindowFunctionAggregateCalls(llvm::Value* aggregate_state,
438  const CompilationOptions& co);
439 
440  // The AVG window function requires some post-processing: the sum is divided by count
441  // and the result is stored back for the current row.
442  void codegenWindowAvgEpilogue(llvm::Value* crt_val,
443  llvm::Value* window_func_null_val,
444  llvm::Value* multiplicity_lv);
445 
446  // Generates code which loads the current aggregate value for the window context.
447  llvm::Value* codegenAggregateWindowState();
448 
449  llvm::Value* aggregateWindowStatePtr();
450 
452  std::vector<std::pair<void*, void*>> native_functions;
453  std::unordered_map<int, CgenState::LiteralValues> literal_values;
455  std::string llvm_ir;
456  };
457 
459  if (dt == ExecutorDeviceType::GPU) {
460  const auto cuda_mgr = catalog_->getDataMgr().getCudaMgr();
461  LOG_IF(FATAL, cuda_mgr == nullptr)
462  << "No CudaMgr instantiated, unable to check device architecture";
463  return cuda_mgr->isArchPascalOrLater();
464  }
465  return false;
466  }
467 
468  struct FetchResult {
469  std::vector<std::vector<const int8_t*>> col_buffers;
470  std::vector<std::vector<int64_t>> num_rows;
471  std::vector<std::vector<uint64_t>> frag_offsets;
472  };
473 
474  bool needFetchAllFragments(const InputColDescriptor& col_desc,
475  const RelAlgExecutionUnit& ra_exe_unit,
476  const FragmentsList& selected_fragments) const;
477 
479  private:
482  const std::vector<InputTableInfo>& query_infos_;
484  mutable std::vector<uint64_t> all_frag_row_offsets_;
485  mutable std::mutex all_frag_row_offsets_mutex_;
486  const std::shared_ptr<RowSetMemoryOwner> row_set_mem_owner_;
488  std::vector<std::pair<ResultSetPtr, std::vector<size_t>>> all_fragment_results_;
489  std::atomic_flag dynamic_watchdog_set_ = ATOMIC_FLAG_INIT;
490  static std::mutex reduce_mutex_;
491 
492  void runImpl(const ExecutorDeviceType chosen_device_type,
493  int chosen_device_id,
494  const ExecutionOptions& eo,
495  const ColumnFetcher& column_fetcher,
496  const QueryCompilationDescriptor& query_comp_desc,
498  const FragmentsList& frag_list,
499  const ExecutorDispatchMode kernel_dispatch_mode,
500  const int64_t rowid_lookup_key);
501 
502  public:
503  ExecutionDispatch(Executor* executor,
504  const RelAlgExecutionUnit& ra_exe_unit,
505  const std::vector<InputTableInfo>& query_infos,
506  const Catalog_Namespace::Catalog& cat,
507  const std::shared_ptr<RowSetMemoryOwner> row_set_mem_owner,
508  RenderInfo* render_info);
509 
510  ExecutionDispatch(const ExecutionDispatch&) = delete;
511 
513 
515 
517 
518  std::tuple<QueryCompilationDescriptorOwned, QueryMemoryDescriptorOwned> compile(
519  const size_t max_groups_buffer_entry_guess,
520  const int8_t crt_min_byte_width,
521  const CompilationOptions& co,
522  const ExecutionOptions& eo,
523  const ColumnFetcher& column_fetcher,
524  const bool has_cardinality_estimation);
525 
526  void run(const ExecutorDeviceType chosen_device_type,
527  int chosen_device_id,
528  const ExecutionOptions& eo,
529  const ColumnFetcher& column_fetcher,
530  const QueryCompilationDescriptor& query_comp_desc,
532  const FragmentsList& frag_ids,
533  const ExecutorDispatchMode kernel_dispatch_mode,
534  const int64_t rowid_lookup_key);
535 
536  const RelAlgExecutionUnit& getExecutionUnit() const;
537 
538  const std::vector<uint64_t>& getFragOffsets() const;
539 
540  std::vector<std::pair<ResultSetPtr, std::vector<size_t>>>& getFragmentResults();
541 
543  };
544 
545  ResultSetPtr executeWorkUnit(size_t& max_groups_buffer_entry_guess,
546  const bool is_agg,
547  const std::vector<InputTableInfo>&,
548  const RelAlgExecutionUnit&,
549  const CompilationOptions&,
550  const ExecutionOptions& options,
552  std::shared_ptr<RowSetMemoryOwner>,
553  RenderInfo* render_info,
554  const bool has_cardinality_estimation,
555  ColumnCacheMap& column_cache);
556 
557  void executeUpdate(const RelAlgExecutionUnit& ra_exe_unit,
558  const std::vector<InputTableInfo>& table_infos,
559  const CompilationOptions& co,
560  const ExecutionOptions& eo,
561  const Catalog_Namespace::Catalog& cat,
562  std::shared_ptr<RowSetMemoryOwner> row_set_mem_owner,
564  const bool is_agg = false);
565 
566  using PerFragmentCallBack =
567  std::function<void(ResultSetPtr, const Fragmenter_Namespace::FragmentInfo&)>;
568 
574  void executeWorkUnitPerFragment(const RelAlgExecutionUnit& ra_exe_unit,
575  const InputTableInfo& table_info,
576  const CompilationOptions& co,
577  const ExecutionOptions& eo,
578  const Catalog_Namespace::Catalog& cat,
579  PerFragmentCallBack& cb);
580 
582 
589  const std::vector<InputTableInfo>& table_infos,
590  const CompilationOptions& co,
591  const ExecutionOptions& eo,
592  const Catalog_Namespace::Catalog& cat);
593 
594  // TODO(alex): remove
596  const RelAlgExecutionUnit& ra_exe_unit,
597  const ExecutorDeviceType requested_device_type);
598 
600  ExecutionDispatch& execution_dispatch,
601  const std::vector<Analyzer::Expr*>& target_exprs,
603  const ExecutorDeviceType device_type,
604  std::shared_ptr<RowSetMemoryOwner> row_set_mem_owner);
605 
607  ExecutionDispatch& execution_dispatch) const;
608 
609  std::unordered_map<int, const Analyzer::BinOper*> getInnerTabIdToJoinCond() const;
610 
611  void dispatchFragments(
612  const std::function<void(const ExecutorDeviceType chosen_device_type,
613  int chosen_device_id,
614  const QueryCompilationDescriptor& query_comp_desc,
616  const FragmentsList& frag_list,
617  const ExecutorDispatchMode kernel_dispatch_mode,
618  const int64_t rowid_lookup_key)> dispatch,
619  const ExecutionDispatch& execution_dispatch,
620  const std::vector<InputTableInfo>& table_infos,
621  const ExecutionOptions& eo,
622  const bool is_agg,
623  const bool allow_single_frag_table_opt,
624  const size_t context_count,
625  const QueryCompilationDescriptor& query_comp_desc,
626  const QueryMemoryDescriptor& query_mem_desc,
627  QueryFragmentDescriptor& fragment_descriptor,
628  std::unordered_set<int>& available_gpus,
629  int& available_cpus);
630 
631  std::vector<size_t> getTableFragmentIndices(
632  const RelAlgExecutionUnit& ra_exe_unit,
633  const ExecutorDeviceType device_type,
634  const size_t table_idx,
635  const size_t outer_frag_idx,
636  std::map<int, const TableFragments*>& selected_tables_fragments,
637  const std::unordered_map<int, const Analyzer::BinOper*>&
638  inner_table_id_to_join_condition);
639 
640  bool skipFragmentPair(const Fragmenter_Namespace::FragmentInfo& outer_fragment_info,
641  const Fragmenter_Namespace::FragmentInfo& inner_fragment_info,
642  const int inner_table_id,
643  const std::unordered_map<int, const Analyzer::BinOper*>&
644  inner_table_id_to_join_condition,
645  const RelAlgExecutionUnit& ra_exe_unit,
646  const ExecutorDeviceType device_type);
647 
649  const RelAlgExecutionUnit& ra_exe_unit,
650  const int device_id,
652  const std::map<int, const TableFragments*>&,
653  const FragmentsList& selected_fragments,
655  std::list<ChunkIter>&,
656  std::list<std::shared_ptr<Chunk_NS::Chunk>>&);
657 
658  std::pair<std::vector<std::vector<int64_t>>, std::vector<std::vector<uint64_t>>>
660  const RelAlgExecutionUnit& ra_exe_unit,
661  const CartesianProduct<std::vector<std::vector<size_t>>>& frag_ids_crossjoin,
662  const std::vector<InputDescriptor>& input_descs,
663  const std::map<int, const TableFragments*>& all_tables_fragments);
664 
666  std::vector<std::vector<size_t>>& selected_fragments_crossjoin,
667  std::vector<size_t>& local_col_to_frag_pos,
668  const std::list<std::shared_ptr<const InputColDescriptor>>& col_global_ids,
669  const FragmentsList& selected_fragments,
670  const RelAlgExecutionUnit& ra_exe_unit);
671 
672  std::vector<size_t> getFragmentCount(const FragmentsList& selected_fragments,
673  const size_t scan_idx,
674  const RelAlgExecutionUnit& ra_exe_unit);
675 
676  int32_t executePlanWithGroupBy(const RelAlgExecutionUnit& ra_exe_unit,
677  const CompilationResult&,
678  const bool hoist_literals,
679  ResultSetPtr& results,
680  const ExecutorDeviceType device_type,
681  std::vector<std::vector<const int8_t*>>& col_buffers,
682  const std::vector<size_t> outer_tab_frag_ids,
684  const std::vector<std::vector<int64_t>>& num_rows,
685  const std::vector<std::vector<uint64_t>>& frag_offsets,
687  const int device_id,
688  const int64_t limit,
689  const uint32_t start_rowid,
690  const uint32_t num_tables,
691  RenderInfo* render_info);
693  const RelAlgExecutionUnit& ra_exe_unit,
694  const CompilationResult&,
695  const bool hoist_literals,
696  ResultSetPtr& results,
697  const std::vector<Analyzer::Expr*>& target_exprs,
698  const ExecutorDeviceType device_type,
699  std::vector<std::vector<const int8_t*>>& col_buffers,
700  QueryExecutionContext* query_exe_context,
701  const std::vector<std::vector<int64_t>>& num_rows,
702  const std::vector<std::vector<uint64_t>>& frag_offsets,
703  Data_Namespace::DataMgr* data_mgr,
704  const int device_id,
705  const uint32_t start_rowid,
706  const uint32_t num_tables,
707  RenderInfo* render_info);
708 
709  public: // Temporary, ask saman about this
710  static std::pair<int64_t, int32_t> reduceResults(const SQLAgg agg,
711  const SQLTypeInfo& ti,
712  const int64_t agg_init_val,
713  const int8_t out_byte_width,
714  const int64_t* out_vec,
715  const size_t out_vec_sz,
716  const bool is_group_by,
717  const bool float_argument_input);
718 
719  static void addCodeToCache(const CodeCacheKey&,
720  std::vector<std::tuple<void*, ExecutionEngineWrapper>>,
721  llvm::Module*,
722  CodeCache&);
723 
724  private:
725  ResultSetPtr resultsUnion(ExecutionDispatch& execution_dispatch);
726  std::vector<int64_t> getJoinHashTablePtrs(const ExecutorDeviceType device_type,
727  const int device_id);
729  const RelAlgExecutionUnit&,
730  std::vector<std::pair<ResultSetPtr, std::vector<size_t>>>& all_fragment_results,
731  std::shared_ptr<RowSetMemoryOwner>,
732  const QueryMemoryDescriptor&) const;
734  std::vector<std::pair<ResultSetPtr, std::vector<size_t>>>& all_fragment_results,
735  std::shared_ptr<RowSetMemoryOwner>,
736  const QueryMemoryDescriptor&) const;
738  const RelAlgExecutionUnit&,
739  std::vector<std::pair<ResultSetPtr, std::vector<size_t>>>& all_fragment_results,
740  std::shared_ptr<RowSetMemoryOwner>,
741  const QueryMemoryDescriptor&) const;
742  void executeSimpleInsert(const Planner::RootPlan* root_plan);
743 
744  ResultSetPtr executeWorkUnitImpl(size_t& max_groups_buffer_entry_guess,
745  const bool is_agg,
746  const bool allow_single_frag_table_opt,
747  const std::vector<InputTableInfo>&,
748  const RelAlgExecutionUnit&,
749  const CompilationOptions&,
750  const ExecutionOptions& options,
752  std::shared_ptr<RowSetMemoryOwner>,
753  RenderInfo* render_info,
754  const bool has_cardinality_estimation,
755  ColumnCacheMap& column_cache);
756 
757  std::vector<llvm::Value*> inlineHoistedLiterals();
758 
759  std::tuple<Executor::CompilationResult, std::unique_ptr<QueryMemoryDescriptor>>
760  compileWorkUnit(const std::vector<InputTableInfo>& query_infos,
761  const RelAlgExecutionUnit& ra_exe_unit,
762  const CompilationOptions& co,
763  const ExecutionOptions& eo,
764  const CudaMgr_Namespace::CudaMgr* cuda_mgr,
765  const bool allow_lazy_fetch,
766  std::shared_ptr<RowSetMemoryOwner>,
767  const size_t max_groups_buffer_entry_count,
768  const int8_t crt_min_byte_width,
769  const bool has_cardinality_estimation,
770  ColumnCacheMap& column_cache,
771  RenderInfo* render_info = nullptr);
772  // Generate code to skip the deleted rows in the outermost table.
773  llvm::BasicBlock* codegenSkipDeletedOuterTableRow(
774  const RelAlgExecutionUnit& ra_exe_unit,
775  const CompilationOptions& co);
776  std::vector<JoinLoop> buildJoinLoops(RelAlgExecutionUnit& ra_exe_unit,
777  const CompilationOptions& co,
778  const ExecutionOptions& eo,
779  const std::vector<InputTableInfo>& query_infos,
780  ColumnCacheMap& column_cache);
781  // Create a callback which generates code which returns true iff the row on the given
782  // level is deleted.
783  std::function<llvm::Value*(const std::vector<llvm::Value*>&, llvm::Value*)>
784  buildIsDeletedCb(const RelAlgExecutionUnit& ra_exe_unit,
785  const size_t level_idx,
786  const CompilationOptions& co);
787  // Builds a join hash table for the provided conditions on the current level.
788  // Returns null iff on failure and provides the reasons in `fail_reasons`.
789  std::shared_ptr<JoinHashTableInterface> buildCurrentLevelHashTable(
790  const JoinCondition& current_level_join_conditions,
791  RelAlgExecutionUnit& ra_exe_unit,
792  const CompilationOptions& co,
793  const std::vector<InputTableInfo>& query_infos,
794  ColumnCacheMap& column_cache,
795  std::vector<std::string>& fail_reasons);
796  llvm::Value* addJoinLoopIterator(const std::vector<llvm::Value*>& prev_iters,
797  const size_t level_idx);
798  void codegenJoinLoops(const std::vector<JoinLoop>& join_loops,
799  const RelAlgExecutionUnit& ra_exe_unit,
800  GroupByAndAggregate& group_by_and_aggregate,
801  llvm::Function* query_func,
802  llvm::BasicBlock* entry_bb,
804  const CompilationOptions& co,
805  const ExecutionOptions& eo);
806  bool compileBody(const RelAlgExecutionUnit& ra_exe_unit,
807  GroupByAndAggregate& group_by_and_aggregate,
809  const CompilationOptions& co);
810 
811  void createErrorCheckControlFlow(llvm::Function* query_func,
812  bool run_with_dynamic_watchdog,
813  ExecutorDeviceType device_type);
814 
815  void preloadFragOffsets(const std::vector<InputDescriptor>& input_descs,
816  const std::vector<InputTableInfo>& query_infos);
817 
819  std::shared_ptr<JoinHashTableInterface> hash_table;
820  std::string fail_reason;
821  };
822 
824  const std::shared_ptr<Analyzer::BinOper>& qual_bin_oper,
825  const std::vector<InputTableInfo>& query_infos,
826  const MemoryLevel memory_level,
827  const JoinHashTableInterface::HashType preferred_hash_type,
828  ColumnCacheMap& column_cache);
829  void nukeOldState(const bool allow_lazy_fetch,
830  const std::vector<InputTableInfo>& query_infos,
831  const RelAlgExecutionUnit* ra_exe_unit);
832 
833  std::vector<std::pair<void*, void*>> optimizeAndCodegenCPU(
834  llvm::Function*,
835  llvm::Function*,
836  const std::unordered_set<llvm::Function*>&,
837  const CompilationOptions&);
838  std::vector<std::pair<void*, void*>> optimizeAndCodegenGPU(
839  llvm::Function*,
840  llvm::Function*,
841  std::unordered_set<llvm::Function*>&,
842  const bool no_inline,
843  const CudaMgr_Namespace::CudaMgr* cuda_mgr,
844  const CompilationOptions&);
845  std::string generatePTX(const std::string&) const;
846  void initializeNVPTXBackend() const;
847 
848  int64_t deviceCycles(int milliseconds) const;
849 
851  llvm::Value* translated_value;
852  llvm::Value* original_value;
853  };
854 
856  const size_t col_width,
857  const CompilationOptions&,
858  const bool translate_null_val,
859  const int64_t translated_null_val,
861  std::stack<llvm::BasicBlock*>&,
862  const bool thread_mem_shared);
863 
864  llvm::Value* castToFP(llvm::Value* val);
865  llvm::Value* castToIntPtrTyIn(llvm::Value* val, const size_t bit_width);
866 
868 
869  std::pair<bool, int64_t> skipFragment(
870  const InputDescriptor& table_desc,
871  const Fragmenter_Namespace::FragmentInfo& frag_info,
872  const std::list<std::shared_ptr<Analyzer::Expr>>& simple_quals,
873  const std::vector<uint64_t>& frag_offsets,
874  const size_t frag_idx);
875 
876  std::pair<bool, int64_t> skipFragmentInnerJoins(
877  const InputDescriptor& table_desc,
878  const RelAlgExecutionUnit& ra_exe_unit,
879  const Fragmenter_Namespace::FragmentInfo& fragment,
880  const std::vector<uint64_t>& frag_offsets,
881  const size_t frag_idx);
882 
884  const std::unordered_set<PhysicalInput>& phys_inputs);
886  const std::unordered_set<PhysicalInput>& phys_inputs);
887  TableGenerations computeTableGenerations(std::unordered_set<int> phys_table_ids);
888 
889  public:
890  void setupCaching(const std::unordered_set<PhysicalInput>& phys_inputs,
891  const std::unordered_set<int>& phys_table_ids);
892 
893  private:
894  std::vector<std::pair<void*, void*>> getCodeFromCache(const CodeCacheKey&,
895  const CodeCache&);
896 
897  void addCodeToCache(const CodeCacheKey&,
898  const std::vector<std::tuple<void*, GpuCompilationContext*>>&,
899  llvm::Module*,
900  CodeCache&);
901 
902  std::vector<int8_t> serializeLiterals(
903  const std::unordered_map<int, CgenState::LiteralValues>& literals,
904  const int device_id);
905 
906  static size_t align(const size_t off_in, const size_t alignment) {
907  size_t off = off_in;
908  if (off % alignment != 0) {
909  off += (alignment - off % alignment);
910  }
911  return off;
912  }
913 
914  std::unique_ptr<CgenState> cgen_state_;
915 
917  public:
919  : cgen_state_(cgen_state), saved_fetch_cache(cgen_state_->fetch_cache_) {}
921 
922  private:
924  std::unordered_map<int, std::vector<llvm::Value*>> saved_fetch_cache;
925  };
926 
927  llvm::Value* spillDoubleElement(llvm::Value* elem_val, llvm::Type* elem_ty);
928 
929  std::unique_ptr<PlanState> plan_state_;
930  std::shared_ptr<RowSetMemoryOwner> row_set_mem_owner_;
931 
932  static const int max_gpu_count{16};
934 
935  mutable std::mutex gpu_active_modules_mutex_;
939 
940  mutable std::shared_ptr<StringDictionaryProxy> lit_str_dict_proxy_;
941  mutable std::mutex str_dict_mutex_;
942 
943  mutable std::unique_ptr<llvm::TargetMachine> nvptx_target_machine_;
944 
947 
948  static const size_t baseline_threshold{
949  1000000}; // if a perfect hash needs more entries, use baseline
950  static const size_t code_cache_size{10000};
951 
952  const unsigned block_size_x_;
953  const unsigned grid_size_x_;
954  const std::string debug_dir_;
955  const std::string debug_file_;
956 
957  const int db_id_;
960 
965 
966  static std::map<int, std::shared_ptr<Executor>> executors_;
967  static std::mutex execute_mutex_;
969 
970  public:
971  static const int32_t ERR_DIV_BY_ZERO{1};
972  static const int32_t ERR_OUT_OF_GPU_MEM{2};
973  static const int32_t ERR_OUT_OF_SLOTS{3};
974  static const int32_t ERR_UNSUPPORTED_SELF_JOIN{4};
975  static const int32_t ERR_OUT_OF_RENDER_MEM{5};
976  static const int32_t ERR_OUT_OF_CPU_MEM{6};
977  static const int32_t ERR_OVERFLOW_OR_UNDERFLOW{7};
978  static const int32_t ERR_SPECULATIVE_TOP_OOM{8};
979  static const int32_t ERR_OUT_OF_TIME{9};
980  static const int32_t ERR_INTERRUPTED{10};
981  static const int32_t ERR_COLUMNAR_CONVERSION_NOT_SUPPORTED{11};
982  static const int32_t ERR_TOO_MANY_LITERALS{12};
983  static const int32_t ERR_STRING_CONST_IN_RESULTSET{13};
985  static const int32_t ERR_SINGLE_VALUE_FOUND_MULTIPLE_VALUES{15};
986 
987  friend class BaselineJoinHashTable;
988  friend class CodeGenerator;
989  friend class ColumnFetcher;
990  friend class OverlapsJoinHashTable;
991  friend class GroupByAndAggregate;
993  friend class QueryMemoryDescriptor;
996  friend class QueryExecutionContext;
997  friend class ResultSet;
998  friend class InValuesBitmap;
999  friend class JoinHashTable;
1000  friend class LeafAggregator;
1001  friend class QueryRewriter;
1003  friend class RelAlgExecutor;
1004  friend class TableOptimizer;
1008  friend struct TargetExprCodegen;
1009 
1010  template <typename META_TYPE_CLASS>
1012 };
1013 
1014 inline std::string get_null_check_suffix(const SQLTypeInfo& lhs_ti,
1015  const SQLTypeInfo& rhs_ti) {
1016  if (lhs_ti.get_notnull() && rhs_ti.get_notnull()) {
1017  return "";
1018  }
1019  std::string null_check_suffix{"_nullable"};
1020  if (lhs_ti.get_notnull()) {
1021  CHECK(!rhs_ti.get_notnull());
1022  null_check_suffix += "_rhs";
1023  } else if (rhs_ti.get_notnull()) {
1024  CHECK(!lhs_ti.get_notnull());
1025  null_check_suffix += "_lhs";
1026  }
1027  return null_check_suffix;
1028 }
1029 
1030 inline bool is_unnest(const Analyzer::Expr* expr) {
1031  return dynamic_cast<const Analyzer::UOper*>(expr) &&
1032  static_cast<const Analyzer::UOper*>(expr)->get_optype() == kUNNEST;
1033 }
1034 
1035 bool is_trivial_loop_join(const std::vector<InputTableInfo>& query_infos,
1036  const RelAlgExecutionUnit& ra_exe_unit);
1037 
1038 std::unordered_set<int> get_available_gpus(const Catalog_Namespace::Catalog& cat);
1039 
1040 size_t get_context_count(const ExecutorDeviceType device_type,
1041  const size_t cpu_count,
1042  const size_t gpu_count);
1043 
1044 extern "C" void register_buffer_with_executor_rsm(int64_t exec, int8_t* buffer);
1045 
1047 
1048 #endif // QUERYENGINE_EXECUTE_H
std::vector< std::vector< int64_t > > num_rows
Definition: Execute.h:470
void read_rt_udf_gpu_module(const std::string &udf_ir)
SQLTypeInfo getColumnType(const size_t col_idx) const
std::vector< std::pair< ResultSetPtr, std::vector< size_t > > > & getFragmentResults()
CudaMgr_Namespace::CudaMgr * getCudaMgr() const
Definition: DataMgr.h:117
const std::string debug_dir_
Definition: Execute.h:954
llvm::Value * translated_value
Definition: Execute.h:851
bool is_fp() const
Definition: sqltypes.h:481
bool is_agg(const Analyzer::Expr *expr)
bool is_boolean() const
Definition: sqltypes.h:484
AggregatedColRange computeColRangesCache(const std::unordered_set< PhysicalInput > &phys_inputs)
Definition: Execute.cpp:3262
SQLAgg
Definition: sqldefs.h:71
#define CHECK_EQ(x, y)
Definition: Logger.h:205
float g_filter_push_down_low_frac
Definition: Execute.cpp:83
ResultSetPtr collectAllDeviceResults(ExecutionDispatch &execution_dispatch, const std::vector< Analyzer::Expr * > &target_exprs, const QueryMemoryDescriptor &query_mem_desc, const ExecutorDeviceType device_type, std::shared_ptr< RowSetMemoryOwner > row_set_mem_owner)
Definition: Execute.cpp:1517
std::vector< uint64_t > all_frag_row_offsets_
Definition: Execute.h:484
std::unique_ptr< llvm::TargetMachine > nvptx_target_machine_
Definition: Execute.h:943
std::unique_ptr< llvm::Module > module(runtime_module_shallow_copy(cgen_state))
size_t g_constrained_by_in_threshold
Definition: Execute.cpp:91
llvm::Value * castToFP(llvm::Value *val)
Definition: Execute.cpp:3002
friend class ResultSet
Definition: Execute.h:997
static void addCodeToCache(const CodeCacheKey &, std::vector< std::tuple< void *, ExecutionEngineWrapper >>, llvm::Module *, CodeCache &)
double g_bump_allocator_step_reduction
Definition: Execute.cpp:100
const int8_t const int64_t * num_rows
static const int32_t ERR_INTERRUPTED
Definition: Execute.h:980
const Analyzer::Expr * remove_cast_to_int(const Analyzer::Expr *expr)
Definition: ColumnIR.cpp:527
class for a per-database catalog. also includes metadata for the current database and the current use...
Definition: Catalog.h:81
std::shared_ptr< StringDictionaryProxy > lit_str_dict_proxy_
Definition: Execute.h:940
HOST DEVICE EncodingType get_compression() const
Definition: sqltypes.h:334
std::vector< std::vector< uint64_t > > frag_offsets
Definition: Execute.h:471
bool is_trivial_loop_join(const std::vector< InputTableInfo > &query_infos, const RelAlgExecutionUnit &ra_exe_unit)
Definition: Execute.cpp:1077
FetchCacheAnchor(CgenState *cgen_state)
Definition: Execute.h:918
void codegenJoinLoops(const std::vector< JoinLoop > &join_loops, const RelAlgExecutionUnit &ra_exe_unit, GroupByAndAggregate &group_by_and_aggregate, llvm::Function *query_func, llvm::BasicBlock *entry_bb, const QueryMemoryDescriptor &query_mem_desc, const CompilationOptions &co, const ExecutionOptions &eo)
Definition: IRCodegen.cpp:459
bool g_strip_join_covered_quals
Definition: Execute.cpp:90
const std::shared_ptr< RowSetMemoryOwner > getRowSetMemoryOwner() const
Definition: Execute.cpp:238
StringDictionaryProxy * getLiteralDictionary() const override
Definition: Execute.h:302
std::shared_ptr< ResultSet > execute(const Planner::RootPlan *root_plan, const Catalog_Namespace::SessionInfo &session, const bool hoist_literals, const ExecutorDeviceType device_type, const ExecutorOptLevel, const bool allow_multifrag, const bool allow_loop_joins, RenderInfo *render_query_data=nullptr)
std::vector< size_t > getTableFragmentIndices(const RelAlgExecutionUnit &ra_exe_unit, const ExecutorDeviceType device_type, const size_t table_idx, const size_t outer_frag_idx, std::map< int, const TableFragments * > &selected_tables_fragments, const std::unordered_map< int, const Analyzer::BinOper * > &inner_table_id_to_join_condition)
Definition: Execute.cpp:1826
bool g_enable_direct_columnarization
Definition: Execute.cpp:101
void dispatchFragments(const std::function< void(const ExecutorDeviceType chosen_device_type, int chosen_device_id, const QueryCompilationDescriptor &query_comp_desc, const QueryMemoryDescriptor &query_mem_desc, const FragmentsList &frag_list, const ExecutorDispatchMode kernel_dispatch_mode, const int64_t rowid_lookup_key)> dispatch, const ExecutionDispatch &execution_dispatch, const std::vector< InputTableInfo > &table_infos, const ExecutionOptions &eo, const bool is_agg, const bool allow_single_frag_table_opt, const size_t context_count, const QueryCompilationDescriptor &query_comp_desc, const QueryMemoryDescriptor &query_mem_desc, QueryFragmentDescriptor &fragment_descriptor, std::unordered_set< int > &available_gpus, int &available_cpus)
Definition: Execute.cpp:1702
ExecutorDeviceType
ResultSetPtr executeTableFunction(const TableFunctionExecutionUnit exe_unit, const std::vector< InputTableInfo > &table_infos, const CompilationOptions &co, const ExecutionOptions &eo, const Catalog_Namespace::Catalog &cat)
Compiles and dispatches a table function; that is, a function that takes as input one or more columns...
Definition: Execute.cpp:1356
void read_rt_udf_cpu_module(const std::string &udf_ir)
Fragmenter_Namespace::RowDataProvider RowDataProvider
Definition: Execute.h:288
static std::shared_ptr< Executor > getExecutor(const int db_id, const std::string &debug_dir="", const std::string &debug_file="", const MapDParameters mapd_parameters=MapDParameters())
Definition: Execute.cpp:127
Data_Namespace::DataMgr & getDataMgr() const
Definition: Catalog.h:177
std::tuple< QueryCompilationDescriptorOwned, QueryMemoryDescriptorOwned > compile(const size_t max_groups_buffer_entry_guess, const int8_t crt_min_byte_width, const CompilationOptions &co, const ExecutionOptions &eo, const ColumnFetcher &column_fetcher, const bool has_cardinality_estimation)
std::unordered_set< int > get_available_gpus(const Catalog_Namespace::Catalog &cat)
Definition: Execute.cpp:957
static const int max_gpu_count
Definition: Execute.h:932
std::unordered_map< int, CgenState::LiteralValues > literal_values
Definition: Execute.h:453
size_t const getFragmentIndex() const
static const size_t code_cache_size
Definition: Execute.h:950
bool isArchPascalOrLater(const ExecutorDeviceType dt) const
Definition: Execute.h:458
static mapd_shared_mutex executors_cache_mutex_
Definition: Execute.h:968
bool is_udf_module_present(bool cpu_only=false)
std::vector< ColumnLazyFetchInfo > getColLazyFetchInfo(const std::vector< Analyzer::Expr * > &target_exprs) const
Definition: Execute.cpp:284
static const size_t baseline_threshold
Definition: Execute.h:948
void registerActiveModule(void *module, const int device_id) const
TableGenerations computeTableGenerations(std::unordered_set< int > phys_table_ids)
Definition: Execute.cpp:3309
static std::mutex reduce_mutex_
Definition: Execute.h:490
const SQLTypeInfo get_column_type(const int col_id, const int table_id, const ColumnDescriptor *cd, const TemporaryTables *temporary_tables)
Definition: Execute.h:186
RelAlgExecutionUnit addDeletedColumn(const RelAlgExecutionUnit &ra_exe_unit)
Definition: Execute.cpp:3052
llvm::Value * aggregateWindowStatePtr()
void read_udf_cpu_module(const std::string &udf_ir_filename)
Driver for running cleanup processes on a table. TableOptimizer provides functions for various cleanu...
SQLTypeInfo get_logical_type_info(const SQLTypeInfo &type_info)
Definition: sqltypes.h:869
static std::pair< int64_t, int32_t > reduceResults(const SQLAgg agg, const SQLTypeInfo &ti, const int64_t agg_init_val, const int8_t out_byte_width, const int64_t *out_vec, const size_t out_vec_sz, const bool is_group_by, const bool float_argument_input)
Definition: Execute.cpp:611
void read_udf_gpu_module(const std::string &udf_ir_filename)
Definition: sqldefs.h:49
std::vector< std::string > CodeCacheKey
Definition: CodeCache.h:61
size_t operator()(const std::vector< int > &vec) const
Definition: Execute.h:274
const Analyzer::Expr * extract_cast_arg(const Analyzer::Expr *expr)
Definition: Execute.h:151
const ColumnarResults * rows_to_columnar_results(std::shared_ptr< RowSetMemoryOwner > row_set_mem_owner, const PtrTy &result, const int number)
Definition: Execute.h:201
size_t g_filter_push_down_passing_row_ubound
Definition: Execute.cpp:85
const RelAlgExecutionUnit & getExecutionUnit() const
AggregatedColRange agg_col_range_cache_
Definition: Execute.h:962
std::shared_ptr< ResultSet > ResultSetPtr
std::unique_ptr< CgenState > cgen_state_
Definition: Execute.h:914
static const int32_t ERR_TOO_MANY_LITERALS
Definition: Execute.h:982
llvm::Value * original_value
Definition: Execute.h:852
std::vector< std::vector< const int8_t * > > col_buffers
Definition: Execute.h:469
bool g_enable_dynamic_watchdog
Definition: Execute.cpp:72
unsigned g_trivial_loop_join_threshold
Definition: Execute.cpp:76
std::vector< Analyzer::Expr * > get_exprs_not_owned(const std::vector< std::shared_ptr< Analyzer::Expr >> &exprs)
Definition: Execute.h:213
uint32_t gpu_active_modules_device_mask_
Definition: Execute.h:936
ExecutionDispatch(Executor *executor, const RelAlgExecutionUnit &ra_exe_unit, const std::vector< InputTableInfo > &query_infos, const Catalog_Namespace::Catalog &cat, const std::shared_ptr< RowSetMemoryOwner > row_set_mem_owner, RenderInfo *render_info)
int deviceCount(const ExecutorDeviceType) const
Definition: Execute.cpp:594
llvm::Value * castToIntPtrTyIn(llvm::Value *val, const size_t bit_width)
Definition: Execute.cpp:3022
#define CHECK_GT(x, y)
Definition: Logger.h:209
bool isCPUOnly() const
Definition: Execute.cpp:208
std::vector< FragmentsPerTable > FragmentsList
bool needFetchAllFragments(const InputColDescriptor &col_desc, const RelAlgExecutionUnit &ra_exe_unit, const FragmentsList &selected_fragments) const
Definition: Execute.cpp:2005
std::string to_string(char const *&&v)
std::function< void(const UpdateLogForFragment &)> Callback
Definition: Execute.h:317
#define LOG_IF(severity, condition)
Definition: Logger.h:287
bool g_enable_overlaps_hashjoin
Definition: Execute.cpp:87
size_t g_max_memory_allocation_size
Definition: Execute.cpp:95
bool g_enable_watchdog
static void clearMemory(const Data_Namespace::MemoryLevel memory_level)
Definition: Execute.cpp:157
bool g_inner_join_fragment_skipping
Definition: Execute.cpp:78
std::tuple< Executor::CompilationResult, std::unique_ptr< QueryMemoryDescriptor > > compileWorkUnit(const std::vector< InputTableInfo > &query_infos, const RelAlgExecutionUnit &ra_exe_unit, const CompilationOptions &co, const ExecutionOptions &eo, const CudaMgr_Namespace::CudaMgr *cuda_mgr, const bool allow_lazy_fetch, std::shared_ptr< RowSetMemoryOwner >, const size_t max_groups_buffer_entry_count, const int8_t crt_min_byte_width, const bool has_cardinality_estimation, ColumnCacheMap &column_cache, RenderInfo *render_info=nullptr)
Fragmenter_Namespace::TableInfo getTableInfo(const int table_id) const
Definition: Execute.cpp:246
ExecutorOptLevel
void executeSimpleInsert(const Planner::RootPlan *root_plan)
Definition: Execute.cpp:2600
std::vector< std::pair< void *, void * > > optimizeAndCodegenCPU(llvm::Function *, llvm::Function *, const std::unordered_set< llvm::Function * > &, const CompilationOptions &)
ExecutorDispatchMode
static const size_t high_scan_limit
Definition: Execute.h:409
CodeCache gpu_code_cache_
Definition: Execute.h:946
std::mutex all_frag_row_offsets_mutex_
Definition: Execute.h:485
static const int32_t ERR_STRING_CONST_IN_RESULTSET
Definition: Execute.h:983
void codegenWindowAvgEpilogue(llvm::Value *crt_val, llvm::Value *window_func_null_val, llvm::Value *multiplicity_lv)
std::vector< int64_t > getJoinHashTablePtrs(const ExecutorDeviceType device_type, const int device_id)
Definition: Execute.cpp:2531
void preloadFragOffsets(const std::vector< InputDescriptor > &input_descs, const std::vector< InputTableInfo > &query_infos)
Definition: Execute.cpp:2892
bool g_null_div_by_zero
Definition: Execute.cpp:75
Executor(const int db_id, const size_t block_size_x, const size_t grid_size_x, const std::string &debug_dir, const std::string &debug_file)
Definition: Execute.cpp:108
std::unordered_map< int, const ResultSetPtr & > TemporaryTables
Definition: InputMetadata.h:31
false auto cgen_state
static const int32_t ERR_STREAMING_TOP_N_NOT_SUPPORTED_IN_RENDER_QUERY
Definition: Execute.h:984
static const int32_t ERR_COLUMNAR_CONVERSION_NOT_SUPPORTED
Definition: Execute.h:981
const ResultSetPtr & get_temporary_table(const TemporaryTables *temporary_tables, const int table_id)
Definition: Execute.h:178
int8_t warpSize() const
Definition: Execute.cpp:2969
ResultSetPtr reduceSpeculativeTopN(const RelAlgExecutionUnit &, std::vector< std::pair< ResultSetPtr, std::vector< size_t >>> &all_fragment_results, std::shared_ptr< RowSetMemoryOwner >, const QueryMemoryDescriptor &) const
Definition: Execute.cpp:930
bool g_enable_columnar_output
Definition: Execute.cpp:86
const ColumnDescriptor * getPhysicalColumnDescriptor(const Analyzer::ColumnVar *, int) const
Definition: Execute.cpp:219
static const int32_t ERR_DIV_BY_ZERO
Definition: Execute.h:971
void run(const ExecutorDeviceType chosen_device_type, int chosen_device_id, const ExecutionOptions &eo, const ColumnFetcher &column_fetcher, const QueryCompilationDescriptor &query_comp_desc, const QueryMemoryDescriptor &query_mem_desc, const FragmentsList &frag_ids, const ExecutorDispatchMode kernel_dispatch_mode, const int64_t rowid_lookup_key)
bool g_from_table_reordering
Definition: Execute.cpp:77
CHECK(cgen_state)
llvm::Value * get_arg_by_name(llvm::Function *func, const std::string &name)
Definition: Execute.h:116
std::vector< llvm::Value * > LLVMValueVector
Definition: Execute.h:325
bool is_time() const
Definition: sqltypes.h:483
size_t get_context_count(const ExecutorDeviceType device_type, const size_t cpu_count, const size_t gpu_count)
Definition: Execute.cpp:969
int get_logical_size() const
Definition: sqltypes.h:337
const ColumnDescriptor * get_column_descriptor_maybe(const int col_id, const int table_id, const Catalog_Namespace::Catalog &cat)
Definition: Execute.h:170
std::vector< TargetValue > getEntryAt(const size_t index) const override
bool compileBody(const RelAlgExecutionUnit &ra_exe_unit, GroupByAndAggregate &group_by_and_aggregate, const QueryMemoryDescriptor &query_mem_desc, const CompilationOptions &co)
std::unordered_map< int, std::vector< llvm::Value * > > fetch_cache_
Definition: CgenState.h:319
decltype(FragmentInfoType::fragmentId) const getFragmentId() const
Definition: Execute.h:311
int64_t deviceCycles(int milliseconds) const
Definition: Execute.cpp:2994
std::string generatePTX(const std::string &) const
const Catalog_Namespace::Catalog & cat_
Definition: Execute.h:483
std::mutex str_dict_mutex_
Definition: Execute.h:941
const Catalog_Namespace::Catalog * catalog_
Definition: Execute.h:958
#define INJECT_TIMER(DESC)
Definition: measure.h:91
friend class PendingExecutionClosure
Definition: Execute.h:1002
static const int32_t ERR_OUT_OF_RENDER_MEM
Definition: Execute.h:975
ResultSetPtr reduceMultiDeviceResults(const RelAlgExecutionUnit &, std::vector< std::pair< ResultSetPtr, std::vector< size_t >>> &all_fragment_results, std::shared_ptr< RowSetMemoryOwner >, const QueryMemoryDescriptor &) const
Definition: Execute.cpp:847
std::shared_timed_mutex mapd_shared_mutex
HOST DEVICE SQLTypes get_type() const
Definition: sqltypes.h:326
const std::string debug_file_
Definition: Execute.h:955
decltype(FragmentInfoType::physicalTableId) const getPhysicalTableId() const
Definition: Execute.h:308
std::shared_ptr< RowSetMemoryOwner > row_set_mem_owner_
Definition: Execute.h:930
Used by Fragmenter classes to store info about each fragment - the fragment id and number of tuples(r...
Definition: Fragmenter.h:79
bool containsLeftDeepOuterJoin() const
Definition: Execute.h:377
void setCatalog(const Catalog_Namespace::Catalog *catalog)
Definition: Execute.cpp:234
const std::vector< uint64_t > & getFragOffsets() const
const std::vector< InputTableInfo > & query_infos_
Definition: Execute.h:482
size_t g_big_group_threshold
Definition: Execute.cpp:92
static const int32_t ERR_OVERFLOW_OR_UNDERFLOW
Definition: Execute.h:977
float g_filter_push_down_high_frac
Definition: Execute.cpp:84
FragmentInfoType const & getFragmentInfo() const
std::unique_ptr< PlanState > plan_state_
Definition: Execute.h:929
const ColumnDescriptor * getMetadataForColumn(int tableId, const std::string &colName) const
static const int32_t ERR_OUT_OF_TIME
Definition: Execute.h:979
void initializeNVPTXBackend() const
HOST DEVICE bool get_notnull() const
Definition: sqltypes.h:333
bool g_bigint_count
const TableGeneration & getTableGeneration(const int table_id) const
Definition: Execute.cpp:250
const std::shared_ptr< RowSetMemoryOwner > row_set_mem_owner_
Definition: Execute.h:486
size_t fragment_index_
Definition: Execute.h:321
const ColumnDescriptor * getColumnDescriptor(const Analyzer::ColumnVar *) const
Definition: Execute.cpp:213
static const int32_t ERR_UNSUPPORTED_SELF_JOIN
Definition: Execute.h:974
const unsigned block_size_x_
Definition: Execute.h:952
void nukeOldState(const bool allow_lazy_fetch, const std::vector< InputTableInfo > &query_infos, const RelAlgExecutionUnit *ra_exe_unit)
Definition: Execute.cpp:2878
const unsigned grid_size_x_
Definition: Execute.h:953
specifies the content in-memory of a row in the column metadata table
size_t g_overlaps_max_table_size_bytes
Definition: Execute.cpp:89
std::vector< TargetValue > getTranslatedEntryAt(const size_t index) const override
static const int32_t ERR_SINGLE_VALUE_FOUND_MULTIPLE_VALUES
Definition: Execute.h:985
static std::map< int, std::shared_ptr< Executor > > executors_
Definition: Execute.h:966
static const int32_t ERR_OUT_OF_GPU_MEM
Definition: Execute.h:972
std::string get_null_check_suffix(const SQLTypeInfo &lhs_ti, const SQLTypeInfo &rhs_ti)
Definition: Execute.h:1014
ResultSetPtr resultsUnion(ExecutionDispatch &execution_dispatch)
Definition: Execute.cpp:821
void interrupt()
const Catalog_Namespace::Catalog * getCatalog() const
Definition: Execute.cpp:230
int32_t executePlanWithoutGroupBy(const RelAlgExecutionUnit &ra_exe_unit, const CompilationResult &, const bool hoist_literals, ResultSetPtr &results, const std::vector< Analyzer::Expr * > &target_exprs, const ExecutorDeviceType device_type, std::vector< std::vector< const int8_t * >> &col_buffers, QueryExecutionContext *query_exe_context, const std::vector< std::vector< int64_t >> &num_rows, const std::vector< std::vector< uint64_t >> &frag_offsets, Data_Namespace::DataMgr *data_mgr, const int device_id, const uint32_t start_rowid, const uint32_t num_tables, RenderInfo *render_info)
Definition: Execute.cpp:2269
bool g_enable_window_functions
Definition: Execute.cpp:93
std::shared_ptr< JoinHashTableInterface > hash_table
Definition: Execute.h:819
void createErrorCheckControlFlow(llvm::Function *query_func, bool run_with_dynamic_watchdog, ExecutorDeviceType device_type)
#define CHECK_LT(x, y)
Definition: Logger.h:207
std::shared_ptr< ResultSet > rs_
Definition: Execute.h:322
void runImpl(const ExecutorDeviceType chosen_device_type, int chosen_device_id, const ExecutionOptions &eo, const ColumnFetcher &column_fetcher, const QueryCompilationDescriptor &query_comp_desc, const QueryMemoryDescriptor &query_mem_desc, const FragmentsList &frag_list, const ExecutorDispatchMode kernel_dispatch_mode, const int64_t rowid_lookup_key)
std::vector< size_t > getFragmentCount(const FragmentsList &selected_fragments, const size_t scan_idx, const RelAlgExecutionUnit &ra_exe_unit)
Definition: Execute.cpp:2112
size_t operator()(const std::pair< int, int > &p) const
Definition: Execute.h:281
llvm::BasicBlock * codegenSkipDeletedOuterTableRow(const RelAlgExecutionUnit &ra_exe_unit, const CompilationOptions &co)
std::unique_ptr< QueryCompilationDescriptor > QueryCompilationDescriptorOwned
Definition: Execute.h:95
FetchResult fetchChunks(const ColumnFetcher &, const RelAlgExecutionUnit &ra_exe_unit, const int device_id, const Data_Namespace::MemoryLevel, const std::map< int, const TableFragments * > &, const FragmentsList &selected_fragments, const Catalog_Namespace::Catalog &, std::list< ChunkIter > &, std::list< std::shared_ptr< Chunk_NS::Chunk >> &)
Definition: Execute.cpp:2024
const ColumnarResults * columnarize_result(std::shared_ptr< RowSetMemoryOwner > row_set_mem_owner, const ResultSetPtr &result, const int frag_id)
Definition: Execute.h:222
std::vector< int8_t > serializeLiterals(const std::unordered_map< int, CgenState::LiteralValues > &literals, const int device_id)
Definition: Execute.cpp:332
StringDictionaryGenerations string_dictionary_generations_
Definition: Execute.h:963
InputTableInfoCache input_table_info_cache_
Definition: Execute.h:961
std::vector< std::pair< void *, void * > > native_functions
Definition: Execute.h:452
bool is_integer() const
Definition: sqltypes.h:479
void codegenWindowFunctionStateInit(llvm::Value *aggregate_state)
void * gpu_active_modules_[max_gpu_count]
Definition: Execute.h:937
ResultSetPtr executeWorkUnit(size_t &max_groups_buffer_entry_guess, const bool is_agg, const std::vector< InputTableInfo > &, const RelAlgExecutionUnit &, const CompilationOptions &, const ExecutionOptions &options, const Catalog_Namespace::Catalog &, std::shared_ptr< RowSetMemoryOwner >, RenderInfo *render_info, const bool has_cardinality_estimation, ColumnCacheMap &column_cache)
Definition: Execute.cpp:1119
CodeCache cpu_code_cache_
Definition: Execute.h:945
ResultSetPtr collectAllDeviceShardedTopResults(ExecutionDispatch &execution_dispatch) const
Definition: Execute.cpp:1628
std::pair< bool, int64_t > skipFragment(const InputDescriptor &table_desc, const Fragmenter_Namespace::FragmentInfo &frag_info, const std::list< std::shared_ptr< Analyzer::Expr >> &simple_quals, const std::vector< uint64_t > &frag_offsets, const size_t frag_idx)
Definition: Execute.cpp:3095
unsigned gridSize() const
Definition: Execute.cpp:2978
bool is_timeinterval() const
Definition: sqltypes.h:488
llvm::Value * spillDoubleElement(llvm::Value *elem_val, llvm::Type *elem_ty)
std::pair< std::vector< std::vector< int64_t > >, std::vector< std::vector< uint64_t > > > getRowCountAndOffsetForAllFrags(const RelAlgExecutionUnit &ra_exe_unit, const CartesianProduct< std::vector< std::vector< size_t >>> &frag_ids_crossjoin, const std::vector< InputDescriptor > &input_descs, const std::map< int, const TableFragments * > &all_tables_fragments)
Definition: Execute.cpp:1958
const int8_t const int64_t const uint64_t const int32_t const int64_t int64_t uint32_t frag_idx
StringDictionaryGenerations computeStringDictionaryGenerations(const std::unordered_set< PhysicalInput > &phys_inputs)
Definition: Execute.cpp:3288
FragmentInfoType const & fragment_info_
Definition: Execute.h:320
bool g_enable_table_functions
Definition: Execute.cpp:94
void executeUpdate(const RelAlgExecutionUnit &ra_exe_unit, const std::vector< InputTableInfo > &table_infos, const CompilationOptions &co, const ExecutionOptions &eo, const Catalog_Namespace::Catalog &cat, std::shared_ptr< RowSetMemoryOwner > row_set_mem_owner, const UpdateLogForFragment::Callback &cb, const bool is_agg=false)
std::pair< bool, int64_t > skipFragmentInnerJoins(const InputDescriptor &table_desc, const RelAlgExecutionUnit &ra_exe_unit, const Fragmenter_Namespace::FragmentInfo &fragment, const std::vector< uint64_t > &frag_offsets, const size_t frag_idx)
Definition: Execute.cpp:3229
void buildSelectedFragsMapping(std::vector< std::vector< size_t >> &selected_fragments_crossjoin, std::vector< size_t > &local_col_to_frag_pos, const std::list< std::shared_ptr< const InputColDescriptor >> &col_global_ids, const FragmentsList &selected_fragments, const RelAlgExecutionUnit &ra_exe_unit)
Definition: Execute.cpp:2126
llvm::Value * codegenAggregateWindowState()
TableGenerations table_generations_
Definition: Execute.h:964
std::tuple< std::string, const Analyzer::Expr *, int64_t, const size_t > AggInfo
Definition: Execute.h:357
void unregisterActiveModule(void *module, const int device_id) const
std::function< void(ResultSetPtr, const Fragmenter_Namespace::FragmentInfo &)> PerFragmentCallBack
Definition: Execute.h:567
void resetInterrupt()
bool g_enable_filter_push_down
Definition: Execute.cpp:82
static const int32_t ERR_SPECULATIVE_TOP_OOM
Definition: Execute.h:978
llvm::Value * addJoinLoopIterator(const std::vector< llvm::Value * > &prev_iters, const size_t level_idx)
Definition: IRCodegen.cpp:442
ResultSetPtr reduceMultiDeviceResultSets(std::vector< std::pair< ResultSetPtr, std::vector< size_t >>> &all_fragment_results, std::shared_ptr< RowSetMemoryOwner >, const QueryMemoryDescriptor &) const
Definition: Execute.cpp:871
llvm::Value * codegenWindowFunctionAggregate(const CompilationOptions &co)
bool is_string() const
Definition: sqltypes.h:477
size_t getNumBytesForFetchedRow() const
Definition: Execute.cpp:258
const int8_t * literals
std::vector< std::pair< void *, void * > > optimizeAndCodegenGPU(llvm::Function *, llvm::Function *, std::unordered_set< llvm::Function * > &, const bool no_inline, const CudaMgr_Namespace::CudaMgr *cuda_mgr, const CompilationOptions &)
static const int32_t ERR_OUT_OF_SLOTS
Definition: Execute.h:973
int32_t executePlanWithGroupBy(const RelAlgExecutionUnit &ra_exe_unit, const CompilationResult &, const bool hoist_literals, ResultSetPtr &results, const ExecutorDeviceType device_type, std::vector< std::vector< const int8_t * >> &col_buffers, const std::vector< size_t > outer_tab_frag_ids, QueryExecutionContext *, const std::vector< std::vector< int64_t >> &num_rows, const std::vector< std::vector< uint64_t >> &frag_offsets, Data_Namespace::DataMgr *, const int device_id, const int64_t limit, const uint32_t start_rowid, const uint32_t num_tables, RenderInfo *render_info)
Definition: Execute.cpp:2417
bool g_allow_cpu_retry
Definition: Execute.cpp:74
std::unordered_map< int, std::unordered_map< int, std::shared_ptr< const ColumnarResults > > > ColumnCacheMap
std::vector< std::pair< ResultSetPtr, std::vector< size_t > > > all_fragment_results_
Definition: Execute.h:488
std::vector< llvm::Value * > inlineHoistedLiterals()
ResultSetPtr executeWorkUnitImpl(size_t &max_groups_buffer_entry_guess, const bool is_agg, const bool allow_single_frag_table_opt, const std::vector< InputTableInfo > &, const RelAlgExecutionUnit &, const CompilationOptions &, const ExecutionOptions &options, const Catalog_Namespace::Catalog &, std::shared_ptr< RowSetMemoryOwner >, RenderInfo *render_info, const bool has_cardinality_estimation, ColumnCacheMap &column_cache)
Definition: Execute.cpp:1160
std::atomic_flag dynamic_watchdog_set_
Definition: Execute.h:489
std::unordered_map< int, const Analyzer::BinOper * > getInnerTabIdToJoinCond() const
Definition: Execute.cpp:1676
ExecutorDeviceType getDeviceTypeForTargets(const RelAlgExecutionUnit &ra_exe_unit, const ExecutorDeviceType requested_device_type)
Definition: Execute.cpp:1388
GroupColLLVMValue groupByColumnCodegen(Analyzer::Expr *group_by_col, const size_t col_width, const CompilationOptions &, const bool translate_null_val, const int64_t translated_null_val, GroupByAndAggregate::DiamondCodegen &, std::stack< llvm::BasicBlock * > &, const bool thread_mem_shared)
Definition: IRCodegen.cpp:504
uint32_t log2_bytes(const uint32_t bytes)
Definition: Execute.h:126
ExpressionRange getColRange(const PhysicalInput &) const
Definition: Execute.cpp:254
std::string numeric_type_name(const SQLTypeInfo &ti)
Definition: Execute.h:159
SQLTypeInfo columnType
UpdateLogForFragment(FragmentInfoType const &fragment_info, size_t const, const std::shared_ptr< ResultSet > &rs)
bool is_unnest(const Analyzer::Expr *expr)
Definition: Execute.h:1030
std::vector< JoinLoop > buildJoinLoops(RelAlgExecutionUnit &ra_exe_unit, const CompilationOptions &co, const ExecutionOptions &eo, const std::vector< InputTableInfo > &query_infos, ColumnCacheMap &column_cache)
Definition: IRCodegen.cpp:218
void executeWorkUnitPerFragment(const RelAlgExecutionUnit &ra_exe_unit, const InputTableInfo &table_info, const CompilationOptions &co, const ExecutionOptions &eo, const Catalog_Namespace::Catalog &cat, PerFragmentCallBack &cb)
Compiles and dispatches a work unit per fragment processing results with the per fragment callback...
Definition: Execute.cpp:1311
std::function< llvm::Value *(const std::vector< llvm::Value * > &, llvm::Value *)> buildIsDeletedCb(const RelAlgExecutionUnit &ra_exe_unit, const size_t level_idx, const CompilationOptions &co)
Definition: IRCodegen.cpp:340
unsigned blockSize() const
Definition: Execute.cpp:2986
Execution unit for relational algebra. It&#39;s a low-level description of any relational algebra operati...
std::unordered_map< int, std::vector< llvm::Value * > > saved_fetch_cache
Definition: Execute.h:924
CgenState * cgen_state_
Definition: Execute.h:923
static size_t align(const size_t off_in, const size_t alignment)
Definition: Execute.h:906
RenderInfo * render_info_
Definition: Execute.h:487
std::unique_ptr< QueryMemoryDescriptor > QueryMemoryDescriptorOwned
Definition: Execute.h:97
bool is_decimal() const
Definition: sqltypes.h:480
size_t const getRowCount() const override
unsigned g_dynamic_watchdog_time_limit
Definition: Execute.cpp:73
static const int32_t ERR_OUT_OF_CPU_MEM
Definition: Execute.h:976
static std::mutex execute_mutex_
Definition: Execute.h:967
int deviceCountForMemoryLevel(const Data_Namespace::MemoryLevel memory_level) const
Definition: Execute.cpp:604
Descriptor for the fragments required for a query.
llvm::Value * codegenWindowFunctionAggregateCalls(llvm::Value *aggregate_state, const CompilationOptions &co)
Fragmenter_Namespace::FragmentInfo FragmentInfoType
Definition: Execute.h:292
ExecutionDispatch & operator=(const ExecutionDispatch &)=delete
bool is_rt_udf_module_present(bool cpu_only=false)
std::mutex gpu_exec_mutex_[max_gpu_count]
Definition: Execute.h:933
JoinHashTableOrError buildHashTableForQualifier(const std::shared_ptr< Analyzer::BinOper > &qual_bin_oper, const std::vector< InputTableInfo > &query_infos, const MemoryLevel memory_level, const JoinHashTableInterface::HashType preferred_hash_type, ColumnCacheMap &column_cache)
Definition: Execute.cpp:2912
void register_buffer_with_executor_rsm(int64_t exec, int8_t *buffer)
StringDictionaryProxy * getStringDictionaryProxy(const int dictId, const std::shared_ptr< RowSetMemoryOwner > row_set_mem_owner, const bool with_generation) const
Definition: Execute.cpp:182
llvm::Value * codegenWindowFunction(const size_t target_index, const CompilationOptions &co)
SQLOps get_optype() const
Definition: Analyzer.h:364
std::shared_ptr< JoinHashTableInterface > buildCurrentLevelHashTable(const JoinCondition &current_level_join_conditions, RelAlgExecutionUnit &ra_exe_unit, const CompilationOptions &co, const std::vector< InputTableInfo > &query_infos, ColumnCacheMap &column_cache, std::vector< std::string > &fail_reasons)
Definition: IRCodegen.cpp:396
bool interrupted_
Definition: Execute.h:938
const TemporaryTables * getTemporaryTables() const
Definition: Execute.cpp:242
const int db_id_
Definition: Execute.h:957
const RelAlgExecutionUnit & ra_exe_unit_
Definition: Execute.h:481
std::mutex gpu_active_modules_mutex_
Definition: Execute.h:935
void setupCaching(const std::unordered_set< PhysicalInput > &phys_inputs, const std::unordered_set< int > &phys_table_ids)
Definition: Execute.cpp:3320
static void nukeCacheOfExecutors()
Definition: Execute.h:348
void clearMetaInfoCache()
Definition: Execute.cpp:325
const ColumnDescriptor * get_column_descriptor(const int col_id, const int table_id, const Catalog_Namespace::Catalog &cat)
Definition: Execute.h:141
std::vector< std::pair< void *, void * > > getCodeFromCache(const CodeCacheKey &, const CodeCache &)
size_t const getEntryCount() const override
llvm::BasicBlock * codegenWindowResetStateControlFlow()
const TemporaryTables * temporary_tables_
Definition: Execute.h:959
CompilationRetryNewScanLimit(const size_t new_scan_limit)
Definition: Execute.h:239
WatchdogException(const std::string &cause)
Definition: Execute.h:111
bool isArchMaxwell(const ExecutorDeviceType dt) const
bool skipFragmentPair(const Fragmenter_Namespace::FragmentInfo &outer_fragment_info, const Fragmenter_Namespace::FragmentInfo &inner_fragment_info, const int inner_table_id, const std::unordered_map< int, const Analyzer::BinOper * > &inner_table_id_to_join_condition, const RelAlgExecutionUnit &ra_exe_unit, const ExecutorDeviceType device_type)
Definition: Execute.cpp:1868
ResultSetPtr executeExplain(const QueryCompilationDescriptor &)
Definition: Execute.cpp:1382