OmniSciDB  a5dc49c757
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ResultSetBuilder.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 
23 #ifndef QUERYENGINE_RESULTSETBUILDER_H
24 #define QUERYENGINE_RESULTSETBUILDER_H
25 
26 #include "RelAlgDag.h"
27 #include "ResultSet.h"
28 
29 // ********************************************************
30 // * Usage
31 //
32 // SomeClass* cls;
33 // ResultSetSomeClassBuilder builder(cls);
34 // // builder ... further config as requried
35 // ResultSet* set = builder.build();
36 //
37 // ********************************************************
38 
40  protected:
41  ResultSet* makeResultSet(const std::vector<TargetInfo>& targets,
42  const ExecutorDeviceType device_type,
44  const std::shared_ptr<RowSetMemoryOwner> row_set_mem_owner,
45  const Executor* executor);
46  void addVarlenBuffer(ResultSet* result_set, std::vector<std::string>& varlen_storage);
47 
48  public:
49  virtual ResultSet* build() = 0;
50 };
51 
53  private:
55  const std::shared_ptr<RowSetMemoryOwner> row_set_mem_owner;
56 
57  public:
59  const std::shared_ptr<RowSetMemoryOwner> row_set_mem_owner);
60 
61  ResultSet* build() override;
62 };
63 
65  private:
67  const std::vector<TargetInfo>& targets;
70  const std::shared_ptr<RowSetMemoryOwner> row_set_mem_owner;
71  const Executor* executor;
72 
73  public:
75  const std::vector<TargetInfo>& targets,
77  const std::shared_ptr<RowSetMemoryOwner> row_set_mem_owner);
78 
81  const std::vector<TargetInfo>& targets,
84  const std::shared_ptr<RowSetMemoryOwner> row_set_mem_owner,
85  const Executor* executor);
86 
87  ResultSet* build() override;
88 
89  // A simplified/common pre-packaged use case for this builder that creates a ResultSet
90  // ExecutorDeviceType is "CPU"
91  // QueryMemoryDescriptor is "Projection"
92  // RowSetMemoryOwner is default
93  static ResultSet* create(std::vector<TargetMetaInfo>& label_infos,
94  std::vector<RelLogicalValues::RowValues>& logical_values);
95 };
96 
97 #endif // QUERYENGINE_RESULTSETBUILDER_H
const std::vector< TargetInfo > & targets
ExecutorDeviceType
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)
ResultSet * build() override
Basic constructors and methods of the row set interface.
ResultSet * build() override
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