OmniSciDB  dfae7c3b14
QueryCompilationDescriptor.cpp
Go to the documentation of this file.
1 /*
2  * Copyright 2019 OmniSci, 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 
18 
19 #include "QueryEngine/Execute.h"
20 
21 std::unique_ptr<QueryMemoryDescriptor> QueryCompilationDescriptor::compile(
22  const size_t max_groups_buffer_entry_guess,
23  const int8_t crt_min_byte_width,
24  const bool has_cardinality_estimation,
25  const RelAlgExecutionUnit& ra_exe_unit,
26  const std::vector<InputTableInfo>& table_infos,
27  const PlanState::DeletedColumnsMap& deleted_cols_map,
28  const ColumnFetcher& column_fetcher,
29  const CompilationOptions& co,
30  const ExecutionOptions& eo,
31  RenderInfo* render_info,
32  Executor* executor) {
35  CHECK(executor);
36  std::unique_ptr<QueryMemoryDescriptor> query_mem_desc;
37  const auto cat = executor->getCatalog();
38  try {
39  std::tie(compilation_result_, query_mem_desc) = executor->compileWorkUnit(
40  table_infos,
41  deleted_cols_map,
42  ra_exe_unit,
43  co,
44  eo,
45  cat->getDataMgr().getCudaMgr(),
46  co.allow_lazy_fetch, // TODO(adb): remove param and just read from CO
47  executor->row_set_mem_owner_,
48  max_groups_buffer_entry_guess,
49  crt_min_byte_width,
50  has_cardinality_estimation,
51  column_fetcher.columnarized_table_cache_,
52  render_info);
53  } catch (const CompilationRetryNoLazyFetch&) {
54  if (executor->cgen_state_->module_) {
55  delete executor->cgen_state_->module_;
56  }
57  std::tie(compilation_result_, query_mem_desc) =
58  executor->compileWorkUnit(table_infos,
59  deleted_cols_map,
60  ra_exe_unit,
61  co,
62  eo,
63  cat->getDataMgr().getCudaMgr(),
64  false,
65  executor->row_set_mem_owner_,
66  max_groups_buffer_entry_guess,
67  crt_min_byte_width,
68  has_cardinality_estimation,
69  column_fetcher.columnarized_table_cache_,
70  render_info);
71  }
73  std::max(query_mem_desc->updateActualMinByteWidth(MAX_BYTE_WIDTH_SUPPORTED),
74  crt_min_byte_width);
75  return query_mem_desc;
76 }
ColumnCacheMap columnarized_table_cache_
std::unique_ptr< QueryMemoryDescriptor > compile(const size_t max_groups_buffer_entry_guess, const int8_t crt_min_byte_width, const bool has_cardinality_estimation, const RelAlgExecutionUnit &ra_exe_unit, const std::vector< InputTableInfo > &table_infos, const PlanState::DeletedColumnsMap &deleted_cols_map, const ColumnFetcher &column_fetcher, const CompilationOptions &co, const ExecutionOptions &eo, RenderInfo *render_info, Executor *executor)
Container for compilation results and assorted options for a single execution unit.
std::string cat(Ts &&... args)
std::unordered_map< TableId, const ColumnDescriptor * > DeletedColumnsMap
Definition: PlanState.h:44
ExecutorDeviceType device_type
#define CHECK(condition)
Definition: Logger.h:197
constexpr int8_t MAX_BYTE_WIDTH_SUPPORTED