OmniSciDB  c07336695a
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 std::unique_ptr<QueryMemoryDescriptor> QueryCompilationDescriptor::compile(
20  const size_t max_groups_buffer_entry_guess,
21  const int8_t crt_min_byte_width,
22  const bool has_cardinality_estimation,
23  const RelAlgExecutionUnit& ra_exe_unit,
24  const std::vector<InputTableInfo>& table_infos,
25  const ColumnFetcher& column_fetcher,
26  const CompilationOptions& co,
27  const ExecutionOptions& eo,
28  RenderInfo* render_info,
29  Executor* executor) {
32  CHECK(executor);
33  std::unique_ptr<QueryMemoryDescriptor> query_mem_desc;
34  const auto cat = executor->getCatalog();
35  try {
36  std::tie(compilation_result_, query_mem_desc) = executor->compileWorkUnit(
37  table_infos,
38  ra_exe_unit,
39  co,
40  eo,
41  cat->getDataMgr().getCudaMgr(),
42  render_info && render_info->isPotentialInSituRender() ? false : true,
43  executor->row_set_mem_owner_,
44  max_groups_buffer_entry_guess,
45  crt_min_byte_width,
46  has_cardinality_estimation,
47  column_fetcher.columnarized_table_cache_,
48  render_info);
49  } catch (const CompilationRetryNoLazyFetch&) {
50  if (executor->cgen_state_->module_) {
51  delete executor->cgen_state_->module_;
52  }
53  std::tie(compilation_result_, query_mem_desc) =
54  executor->compileWorkUnit(table_infos,
55  ra_exe_unit,
56  co,
57  eo,
58  cat->getDataMgr().getCudaMgr(),
59  false,
60  executor->row_set_mem_owner_,
61  max_groups_buffer_entry_guess,
62  crt_min_byte_width,
63  has_cardinality_estimation,
64  column_fetcher.columnarized_table_cache_,
65  render_info);
66  }
68  std::max(query_mem_desc->updateActualMinByteWidth(MAX_BYTE_WIDTH_SUPPORTED),
69  crt_min_byte_width);
70  return query_mem_desc;
71 }
ColumnCacheMap columnarized_table_cache_
Definition: ColumnFetcher.h:79
Executor::CompilationResult compilation_result_
Container for compilation results and assorted options for a single execution unit.
bool isPotentialInSituRender() const
Definition: RenderInfo.cpp:55
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)
#define CHECK(condition)
Definition: Logger.h:187
constexpr int8_t MAX_BYTE_WIDTH_SUPPORTED