OmniSciDB  04ee39c94c
RelAlgExecutionDescriptor.h
Go to the documentation of this file.
1 /*
2  * Copyright 2017 MapD Technologies, 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 #ifndef QUERYENGINE_RELALGEXECUTIONDESCRIPTOR_H
18 #define QUERYENGINE_RELALGEXECUTIONDESCRIPTOR_H
19 
20 #include "../GroupByAndAggregate.h"
21 #include "../JoinFilterPushDown.h"
22 #include "../RelAlgAbstractInterpreter.h"
23 
24 class ResultSet;
25 
27  public:
28  ExecutionResult(const std::shared_ptr<ResultSet>& rows,
29  const std::vector<TargetMetaInfo>& targets_meta)
30  : result_(rows), targets_meta_(targets_meta), filter_push_down_enabled_(false) {}
31 
32  ExecutionResult(ResultSetPtr&& result, const std::vector<TargetMetaInfo>& targets_meta)
33  : targets_meta_(targets_meta), filter_push_down_enabled_(false) {
34  result_ = std::move(result);
35  }
36 
41  if (!pushed_down_filter_info_.empty() ||
43  return;
44  }
45  result_ = that.result_;
46  }
47 
49  : targets_meta_(std::move(that.targets_meta_))
52  if (!pushed_down_filter_info_.empty() ||
54  return;
55  }
56  result_ = std::move(that.result_);
57  }
58 
59  ExecutionResult(const std::vector<PushedDownFilterInfo>& pushed_down_filter_info,
60  bool filter_push_down_enabled)
61  : pushed_down_filter_info_(pushed_down_filter_info)
62  , filter_push_down_enabled_(filter_push_down_enabled) {}
63 
65  if (!that.pushed_down_filter_info_.empty() ||
66  (that.filter_push_down_enabled_ && that.pushed_down_filter_info_.empty())) {
69  return *this;
70  }
71  result_ = that.result_;
73  return *this;
74  }
75 
76  const std::shared_ptr<ResultSet>& getRows() const { return result_; }
77 
78  bool empty() const { return !result_; }
79 
80  const ResultSetPtr& getDataPtr() const { return result_; }
81 
82  const std::vector<TargetMetaInfo>& getTargetsMeta() const { return targets_meta_; }
83 
84  const std::vector<PushedDownFilterInfo>& getPushedDownFilterInfo() const {
86  }
87 
88  const bool isFilterPushDownEnabled() const { return filter_push_down_enabled_; }
89 
90  void setQueueTime(const int64_t queue_time_ms) {
91  CHECK(result_);
92  result_->setQueueTime(queue_time_ms);
93  }
94 
95  private:
97  std::vector<TargetMetaInfo> targets_meta_;
98  // filters chosen to be pushed down
99  std::vector<PushedDownFilterInfo> pushed_down_filter_info_;
100  // whether or not it was allowed to look for filters to push down
102 };
103 
105  public:
107  : body_(body)
108  , result_(std::make_shared<ResultSet>(std::vector<TargetInfo>{},
111  nullptr,
112  nullptr),
113  {}) {}
114 
115  const ExecutionResult& getResult() const { return result_; }
116 
118  result_ = result;
119  body_->setContextData(this);
120  }
121 
122  const RelAlgNode* getBody() const { return body_; }
123 
124  private:
127 };
128 
129 std::vector<RaExecutionDesc> get_execution_descriptors(const RelAlgNode*);
130 std::vector<RaExecutionDesc> get_execution_descriptors(
131  const std::vector<const RelAlgNode*>&);
132 
133 #endif // QUERYENGINE_RELALGEXECUTIONDESCRIPTOR_H
const ExecutionResult & getResult() const
ExecutionResult(ResultSetPtr &&result, const std::vector< TargetMetaInfo > &targets_meta)
ExecutionResult(const std::vector< PushedDownFilterInfo > &pushed_down_filter_info, bool filter_push_down_enabled)
void setQueueTime(const int64_t queue_time_ms)
const RelAlgNode * body_
std::shared_ptr< ResultSet > ResultSetPtr
ResultSet(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)
Definition: ResultSet.cpp:91
ExecutionResult & operator=(const ExecutionResult &that)
const RelAlgNode * getBody() const
RaExecutionDesc(const RelAlgNode *body)
const ResultSetPtr & getDataPtr() const
ExecutionResult(const std::shared_ptr< ResultSet > &rows, const std::vector< TargetMetaInfo > &targets_meta)
std::vector< PushedDownFilterInfo > pushed_down_filter_info_
const std::shared_ptr< ResultSet > & getRows() const
ExecutionResult(const ExecutionResult &that)
const std::vector< TargetMetaInfo > & getTargetsMeta() const
#define CHECK(condition)
Definition: Logger.h:187
const std::vector< PushedDownFilterInfo > & getPushedDownFilterInfo() const
ExecutionResult(ExecutionResult &&that)
std::vector< RaExecutionDesc > get_execution_descriptors(const RelAlgNode *)
std::vector< TargetMetaInfo > targets_meta_
void setResult(const ExecutionResult &result)
const bool isFilterPushDownEnabled() const