OmniSciDB  06b3bd477c
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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 ColumnFetcher& column_fetcher,
28  const CompilationOptions& co,
29  const ExecutionOptions& eo,
30  RenderInfo* render_info,
31  Executor* executor) {
34  CHECK(executor);
35  std::unique_ptr<QueryMemoryDescriptor> query_mem_desc;
36  const auto cat = executor->getCatalog();
37  try {
38  std::tie(compilation_result_, query_mem_desc) = executor->compileWorkUnit(
39  table_infos,
40  ra_exe_unit,
41  co,
42  eo,
43  cat->getDataMgr().getCudaMgr(),
44  co.allow_lazy_fetch, // TODO(adb): remove param and just read from CO
45  executor->row_set_mem_owner_,
46  max_groups_buffer_entry_guess,
47  crt_min_byte_width,
48  has_cardinality_estimation,
49  column_fetcher.columnarized_table_cache_,
50  render_info);
51  } catch (const CompilationRetryNoLazyFetch&) {
52  if (executor->cgen_state_->module_) {
53  delete executor->cgen_state_->module_;
54  }
55  std::tie(compilation_result_, query_mem_desc) =
56  executor->compileWorkUnit(table_infos,
57  ra_exe_unit,
58  co,
59  eo,
60  cat->getDataMgr().getCudaMgr(),
61  false,
62  executor->row_set_mem_owner_,
63  max_groups_buffer_entry_guess,
64  crt_min_byte_width,
65  has_cardinality_estimation,
66  column_fetcher.columnarized_table_cache_,
67  render_info);
68  }
70  std::max(query_mem_desc->updateActualMinByteWidth(MAX_BYTE_WIDTH_SUPPORTED),
71  crt_min_byte_width);
72  return query_mem_desc;
73 }
std::string cat(Ts &&...args)
ColumnCacheMap columnarized_table_cache_
Container for compilation results and assorted options for a single execution unit.
CHECK(cgen_state)
ExecutorDeviceType device_type
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 ColumnFetcher &column_fetcher, const CompilationOptions &co, const ExecutionOptions &eo, RenderInfo *render_info, Executor *executor)
constexpr int8_t MAX_BYTE_WIDTH_SUPPORTED