OmniSciDB  a5dc49c757
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ExternalExecutor.h
Go to the documentation of this file.
1 /*
2  * Copyright 2022 HEAVY.AI, 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 #pragma once
18 
19 #include <string>
20 #include <vector>
21 
23 #include "QueryEngine/PlanState.h"
26 #include "ThirdParty/sqlite3/sqlite3.h"
27 
28 class Executor;
29 
32  std::vector<TargetMetaInfo> schema;
33  std::string from_table;
34  const Executor* executor;
35 };
36 
39  std::vector<TargetInfo> target_infos;
40  const Executor* executor;
41 };
42 
43 class NativeExecutionError : public std::runtime_error {
44  public:
45  NativeExecutionError(const std::string& message) : std::runtime_error(message) {}
46 };
47 
49  public:
50  SqliteMemDatabase(const ExternalQueryTable& external_query_table);
51 
53 
54  void run(const std::string& sql);
55  std::unique_ptr<ResultSet> runSelect(const std::string& sql,
56  const ExternalQueryOutputSpec& output_spec);
57 
58  private:
59  sqlite3* db_;
61  static std::mutex session_mutex_;
62 };
63 
64 std::unique_ptr<ResultSet> run_query_external(const ExecutionUnitSql& sql,
65  const FetchResult& fetch_result,
66  const PlanState* plan_state,
67  const ExternalQueryOutputSpec& output_spec);
68 
bool is_supported_type_for_extern_execution(const SQLTypeInfo &ti)
std::vector< TargetMetaInfo > schema
void run(const std::string &sql)
std::unique_ptr< ResultSet > run_query_external(const ExecutionUnitSql &sql, const FetchResult &fetch_result, const PlanState *plan_state, const ExternalQueryOutputSpec &output_spec)
const Executor * executor
std::unique_ptr< ResultSet > runSelect(const std::string &sql, const ExternalQueryOutputSpec &output_spec)
std::string from_table
std::vector< TargetInfo > target_infos
Executor(const ExecutorId id, Data_Namespace::DataMgr *data_mgr, const size_t block_size_x, const size_t grid_size_x, const size_t max_gpu_slab_size, const std::string &debug_dir, const std::string &debug_file)
Definition: Execute.cpp:276
QueryMemoryDescriptor query_mem_desc
const Executor * executor
ExternalQueryTable external_query_table_
static std::mutex session_mutex_
FetchResult fetch_result
NativeExecutionError(const std::string &message)
SqliteMemDatabase(const ExternalQueryTable &external_query_table)