You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@quickstep.apache.org by sh...@apache.org on 2016/06/27 15:53:30 UTC
incubator-quickstep git commit: Added move semantic in
optimizer::logical::Sort
Repository: incubator-quickstep
Updated Branches:
refs/heads/move-semantic-in-logical-sort [created] 87c5428a8
Added move semantic in optimizer::logical::Sort
Project: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/commit/87c5428a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/tree/87c5428a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/diff/87c5428a
Branch: refs/heads/move-semantic-in-logical-sort
Commit: 87c5428a8b295938a89b5b066805a5ea3484c3ef
Parents: 714874c
Author: shixuan-fan <sh...@apache.org>
Authored: Mon Jun 27 15:50:56 2016 +0000
Committer: shixuan-fan <sh...@apache.org>
Committed: Mon Jun 27 15:50:56 2016 +0000
----------------------------------------------------------------------
query_optimizer/logical/Sort.hpp | 26 ++++++++++++++++++++++++++
query_optimizer/resolver/Resolver.cpp | 18 +++++++++---------
2 files changed, 35 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/87c5428a/query_optimizer/logical/Sort.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/logical/Sort.hpp b/query_optimizer/logical/Sort.hpp
index c20ce0f..25f0ada 100644
--- a/query_optimizer/logical/Sort.hpp
+++ b/query_optimizer/logical/Sort.hpp
@@ -113,6 +113,19 @@ class Sort : public Logical {
limit));
}
+ static SortPtr Create(
+ const LogicalPtr &input,
+ const std::vector<expressions::AttributeReferencePtr> &&sort_attributes,
+ const std::vector<bool> &&sort_ascending,
+ const std::vector<bool> &&nulls_first_flags,
+ const int limit) {
+ return SortPtr(new Sort(input,
+ std::move(sort_attributes),
+ std::move(sort_ascending),
+ std::move(nulls_first_flags),
+ limit));
+ }
+
protected:
void getFieldStringItems(
std::vector<std::string> *inline_field_names,
@@ -137,6 +150,19 @@ class Sort : public Logical {
addChild(input_);
}
+ Sort(const LogicalPtr &input,
+ const std::vector<expressions::AttributeReferencePtr> &&sort_attributes,
+ const std::vector<bool> &&sort_ascending,
+ const std::vector<bool> &&nulls_first_flags,
+ const int limit)
+ : input_(input),
+ sort_attributes_(std::move(sort_attributes)),
+ sort_ascending_(std::move(sort_ascending)),
+ nulls_first_flags_(std::move(nulls_first_flags)),
+ limit_(limit) {
+ addChild(input_);
+ }
+
LogicalPtr input_;
std::vector<expressions::AttributeReferencePtr> sort_attributes_;
// Has 1:1 matching with <sort_expressions_>.
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/87c5428a/query_optimizer/resolver/Resolver.cpp
----------------------------------------------------------------------
diff --git a/query_optimizer/resolver/Resolver.cpp b/query_optimizer/resolver/Resolver.cpp
index f880ce7..1eb6d86 100644
--- a/query_optimizer/resolver/Resolver.cpp
+++ b/query_optimizer/resolver/Resolver.cpp
@@ -1270,16 +1270,16 @@ L::LogicalPtr Resolver::resolveSelect(
if (select_query.limit() != nullptr) {
logical_plan =
L::Sort::Create(logical_plan,
- order_by_attributes,
- order_by_directions,
- nulls_first,
+ std::move(order_by_attributes),
+ std::move(order_by_directions),
+ std::move(nulls_first),
select_query.limit()->limit_expression()->long_value());
} else {
logical_plan =
L::Sort::Create(logical_plan,
- order_by_attributes,
- order_by_directions,
- nulls_first,
+ std::move(order_by_attributes),
+ std::move(order_by_directions),
+ std::move(nulls_first),
-1 /* limit */);
}
} else if (select_query.limit() != nullptr) {
@@ -1880,9 +1880,9 @@ L::LogicalPtr Resolver::resolveSortInWindow(
L::LogicalPtr sorted_logical_plan =
L::Sort::Create(logical_plan,
- sort_attributes,
- sort_directions,
- sort_nulls_first,
+ std::move(sort_attributes),
+ std::move(sort_directions),
+ std::move(sort_nulls_first),
-1 /* limit */);
return sorted_logical_plan;