OmniSciDB  fe05a0c208
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ResultSetBuilder.h
Go to the documentation of this file.
1 /*
2  * Copyright 2020 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 
25 #ifndef QUERYENGINE_RESULTSETBUILDER_H
26 #define QUERYENGINE_RESULTSETBUILDER_H
27 
28 #include "RelAlgDagBuilder.h"
29 #include "ResultSet.h"
30 
31 // ********************************************************
32 // * Usage
33 //
34 // SomeClass* cls;
35 // ResultSetSomeClassBuilder builder(cls);
36 // // builder ... further config as requried
37 // ResultSet* set = builder.build();
38 //
39 // ********************************************************
40 
42  protected:
43  ResultSet* makeResultSet(const std::vector<TargetInfo>& targets,
44  const ExecutorDeviceType device_type,
46  const std::shared_ptr<RowSetMemoryOwner> row_set_mem_owner,
47  const Executor* executor);
48  void addVarlenBuffer(ResultSet* result_set, std::vector<std::string>& varlen_storage);
49 
50  public:
51  virtual ResultSet* build() = 0;
52 };
53 
55  private:
57  const std::shared_ptr<RowSetMemoryOwner> row_set_mem_owner;
58 
59  public:
61  const std::shared_ptr<RowSetMemoryOwner> row_set_mem_owner);
62 
63  ResultSet* build();
64 };
65 
67  private:
69  const std::vector<TargetInfo>& targets;
72  const std::shared_ptr<RowSetMemoryOwner> row_set_mem_owner;
73  const Executor* executor;
74 
75  public:
77  const std::vector<TargetInfo>& targets,
79  const std::shared_ptr<RowSetMemoryOwner> row_set_mem_owner);
80 
83  const std::vector<TargetInfo>& targets,
86  const std::shared_ptr<RowSetMemoryOwner> row_set_mem_owner,
87  const Executor* executor);
88 
89  ResultSet* build();
90 
91  // A simplified/common pre-packaged use case for this builder that creates a ResultSet
92  // ExecutorDeviceType is "CPU"
93  // QueryMemoryDescriptor is "Projection"
94  // RowSetMemoryOwner is default
95  static ResultSet* create(std::vector<TargetMetaInfo>& label_infos,
96  std::vector<RelLogicalValues::RowValues>& logical_values);
97 };
98 
99 #endif // QUERYENGINE_RESULTSETBUILDER_H
ExecutorDeviceType
const std::vector< TargetInfo > & targets
virtual ResultSet * build()=0
ResultSet * makeResultSet(const std::vector< TargetInfo > &targets, const ExecutorDeviceType device_type, const QueryMemoryDescriptor &query_mem_desc, const std::shared_ptr< RowSetMemoryOwner > row_set_mem_owner, const Executor *executor)
const ExecutorDeviceType device_type
const std::shared_ptr< RowSetMemoryOwner > row_set_mem_owner
static ResultSet * create(std::vector< TargetMetaInfo > &label_infos, std::vector< RelLogicalValues::RowValues > &logical_values)
const QueryMemoryDescriptor & query_mem_desc
ResultSetDefaultBuilder(const QueryMemoryDescriptor &query_mem_desc, const std::shared_ptr< RowSetMemoryOwner > row_set_mem_owner)
const RelLogicalValues * logical_values
ResultSetLogicalValuesBuilder(const std::vector< TargetInfo > &targets, const QueryMemoryDescriptor &query_mem_desc, const std::shared_ptr< RowSetMemoryOwner > row_set_mem_owner)
Basic constructors and methods of the row set interface.
void addVarlenBuffer(ResultSet *result_set, std::vector< std::string > &varlen_storage)
const std::shared_ptr< RowSetMemoryOwner > row_set_mem_owner
const QueryMemoryDescriptor & query_mem_desc