Skip to content
This repository was archived by the owner on May 9, 2024. It is now read-only.

Commit e262656

Browse files
committed
Refactor const ref args in Node classes ctors and setters.
Signed-off-by: ienkovich <[email protected]>
1 parent b0bc9ca commit e262656

File tree

1 file changed

+22
-21
lines changed

1 file changed

+22
-21
lines changed

omniscidb/IR/Node.h

+22-21
Original file line numberDiff line numberDiff line change
@@ -314,10 +314,10 @@ class Project : public Node {
314314
public:
315315
// Takes memory ownership of the expressions.
316316
Project(ExprPtrVector exprs,
317-
const std::vector<std::string>& fields,
317+
std::vector<std::string> fields,
318318
std::shared_ptr<const Node> input)
319319
: exprs_(std::move(exprs))
320-
, fields_(fields)
320+
, fields_(std::move(fields))
321321
, hint_applied_(false)
322322
, hints_(std::make_unique<Hints>()) {
323323
inputs_.push_back(input);
@@ -353,7 +353,7 @@ class Project : public Node {
353353
const ExprPtrVector& getExprs() const { return exprs_; }
354354

355355
const std::vector<std::string>& getFields() const { return fields_; }
356-
void setFields(std::vector<std::string>&& fields) { fields_ = std::move(fields); }
356+
void setFields(std::vector<std::string> fields) { fields_ = std::move(fields); }
357357

358358
const std::string getFieldName(const size_t i) const {
359359
CHECK_LT(i, fields_.size());
@@ -434,14 +434,14 @@ class Aggregate : public Node {
434434
// Takes ownership of the aggregate expressions.
435435
Aggregate(const size_t groupby_count,
436436
ExprPtrVector aggs,
437-
const std::vector<std::string>& fields,
437+
std::vector<std::string> fields,
438438
std::shared_ptr<const Node> input)
439439
: groupby_count_(groupby_count)
440-
, aggs_(aggs)
441-
, fields_(fields)
440+
, aggs_(std::move(aggs))
441+
, fields_(std::move(fields))
442442
, hint_applied_(false)
443443
, hints_(std::make_unique<Hints>()) {
444-
inputs_.push_back(input);
444+
inputs_.emplace_back(std::move(input));
445445
}
446446

447447
Aggregate(Aggregate const&);
@@ -453,9 +453,7 @@ class Aggregate : public Node {
453453
const size_t getAggsCount() const { return aggs_.size(); }
454454

455455
const std::vector<std::string>& getFields() const { return fields_; }
456-
void setFields(std::vector<std::string>&& new_fields) {
457-
fields_ = std::move(new_fields);
458-
}
456+
void setFields(std::vector<std::string> new_fields) { fields_ = std::move(new_fields); }
459457

460458
const std::string getFieldName(const size_t i) const {
461459
CHECK_LT(i, fields_.size());
@@ -550,8 +548,8 @@ class Join : public Node {
550548
, join_type_(join_type)
551549
, hint_applied_(false)
552550
, hints_(std::make_unique<Hints>()) {
553-
inputs_.push_back(lhs);
554-
inputs_.push_back(rhs);
551+
inputs_.emplace_back(std::move(lhs));
552+
inputs_.emplace_back(std::move(rhs));
555553
}
556554

557555
Join(Join const&);
@@ -744,7 +742,7 @@ class Filter : public Node {
744742
Filter(ExprPtr condition, std::shared_ptr<const Node> input)
745743
: condition_(std::move(condition)) {
746744
CHECK(condition_);
747-
inputs_.push_back(input);
745+
inputs_.emplace_back(std::move(input));
748746
}
749747
750748
// for dummy filter node for data recycler
@@ -939,12 +937,15 @@ class Compound : public Node {
939937
940938
class Sort : public Node {
941939
public:
942-
Sort(const std::vector<SortField>& collation,
940+
Sort(std::vector<SortField> collation,
943941
const size_t limit,
944942
const size_t offset,
945943
std::shared_ptr<const Node> input)
946-
: collation_(collation), limit_(limit), offset_(offset), empty_result_(false) {
947-
inputs_.push_back(input);
944+
: collation_(std::move(collation))
945+
, limit_(limit)
946+
, offset_(offset)
947+
, empty_result_(false) {
948+
inputs_.emplace_back(std::move(input));
948949
}
949950
950951
bool operator==(const Sort& that) const {
@@ -959,7 +960,7 @@ class Sort : public Node {
959960
return collation_[i];
960961
}
961962
962-
void setCollation(std::vector<SortField>&& collation) {
963+
void setCollation(std::vector<SortField> collation) {
963964
collation_ = std::move(collation);
964965
}
965966
@@ -1033,8 +1034,8 @@ class TableFunction : public Node {
10331034
: Node(std::move(inputs))
10341035
, function_name_(function_name)
10351036
, fields_(std::move(fields))
1036-
, col_input_exprs_(col_input_exprs)
1037-
, table_func_input_exprs_(table_func_input_exprs)
1037+
, col_input_exprs_(std::move(col_input_exprs))
1038+
, table_func_input_exprs_(std::move(table_func_input_exprs))
10381039
, tuple_type_(std::move(tuple_type)) {}
10391040
10401041
TableFunction(TableFunction const&);
@@ -1118,9 +1119,9 @@ class TableFunction : public Node {
11181119
11191120
class LogicalValues : public Node {
11201121
public:
1121-
LogicalValues(const std::vector<TargetMetaInfo>& tuple_type,
1122+
LogicalValues(std::vector<TargetMetaInfo> tuple_type,
11221123
std::vector<ExprPtrVector> values)
1123-
: tuple_type_(tuple_type), values_(std::move(values)) {}
1124+
: tuple_type_(std::move(tuple_type)), values_(std::move(values)) {}
11241125
11251126
LogicalValues(LogicalValues const&);
11261127

0 commit comments

Comments
 (0)