-
Notifications
You must be signed in to change notification settings - Fork 1.2k
/
UnionExecutor.cpp
38 lines (28 loc) · 1.09 KB
/
UnionExecutor.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// Copyright (c) 2020 vesoft inc. All rights reserved.
//
// This source code is licensed under Apache 2.0 License.
#include "graph/executor/query/UnionExecutor.h"
#include "graph/planner/plan/Query.h"
namespace nebula {
namespace graph {
folly::Future<Status> UnionExecutor::execute() {
SCOPED_TIMER(&execTime_);
NG_RETURN_IF_ERROR(checkInputDataSets());
auto left = getLeftInputDataIter();
auto right = getRightInputDataIter();
DataSet ds;
ds.colNames = std::move(colNames_);
DCHECK(left->isSequentialIter());
auto leftIter = static_cast<SequentialIter*>(left.get());
ds.rows.insert(ds.rows.end(),
std::make_move_iterator(leftIter->begin()),
std::make_move_iterator(leftIter->end()));
DCHECK(right->isSequentialIter());
auto rightIter = static_cast<SequentialIter*>(right.get());
ds.rows.insert(ds.rows.end(),
std::make_move_iterator(rightIter->begin()),
std::make_move_iterator(rightIter->end()));
return finish(ResultBuilder().value(Value(std::move(ds))).build());
}
} // namespace graph
} // namespace nebula