Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shortest path #4071

Merged
merged 40 commits into from
Jun 7, 2022
Merged
Show file tree
Hide file tree
Changes from 38 commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
2ac3687
shortestpath
jackwener Mar 1, 2022
0b41c70
frame
jackwener Mar 3, 2022
43488ad
fix
jackwener Mar 4, 2022
7b0ef22
fix
jackwener Mar 8, 2022
21b0917
fix
jackwener Mar 10, 2022
97b1a33
almost finish
jackwener Mar 11, 2022
e588526
fix
jackwener Mar 15, 2022
9fbc4f0
fix
jackwener Mar 15, 2022
6590ac4
add tck
jackwener Mar 15, 2022
e405851
refactor shortest path
nevermore3 Mar 22, 2022
908c76d
conjunct path
nevermore3 Mar 22, 2022
e74d35b
conjunct path
nevermore3 Mar 23, 2022
6bf8729
create left & right path
nevermore3 Mar 23, 2022
70a8031
fix error
nevermore3 Mar 23, 2022
842d43b
fix compile error
nevermore3 Mar 23, 2022
6e4c8ad
fix createPath error
nevermore3 Mar 23, 2022
7395711
concurrent execute
nevermore3 Mar 25, 2022
c8a5696
rebase
nevermore3 Apr 22, 2022
a7a5933
add shortestpath plan
nevermore3 Apr 25, 2022
806e7a3
fix error
nevermore3 Apr 25, 2022
f79625f
add test case
nevermore3 Apr 27, 2022
deb5645
same change
nevermore3 Apr 27, 2022
378afab
add comment
nevermore3 Apr 28, 2022
fb2adc1
fix spell error
nevermore3 May 7, 2022
d987d06
batch process
nevermore3 May 7, 2022
138a6a4
batch shortest path
nevermore3 May 19, 2022
0f31aac
add singleShortestPath file
nevermore3 May 20, 2022
7b8ad34
add batchshortest path
nevermore3 May 23, 2022
3b4170c
new batch process
nevermore3 May 24, 2022
1b4b619
fix error
nevermore3 May 25, 2022
f4c9668
rebase
nevermore3 May 25, 2022
5b0c8fc
format
nevermore3 May 25, 2022
e50e332
fix batchShortestPath 's single problem
nevermore3 May 25, 2022
439ce19
fix define error
nevermore3 May 25, 2022
effd7c1
fix test case
nevermore3 May 26, 2022
3cea135
Synchronous interface is replaced by asynchronous interface in batch …
nevermore3 May 31, 2022
b8775f7
Synchronous interface is replaced by asynchronous interface in single…
nevermore3 May 31, 2022
af4cc2e
del testcase
nevermore3 Jun 6, 2022
a645a3f
Merge branch 'master' into shortest_path
Sophie-Xie Jun 6, 2022
e7b1b48
Merge branch 'master' into shortest_path
Sophie-Xie Jun 7, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/graph/context/Iterator.h
Original file line number Diff line number Diff line change
Expand Up @@ -499,6 +499,7 @@ class SequentialIter : public Iterator {
friend class DataCollectExecutor;
friend class AppendVerticesExecutor;
friend class TraverseExecutor;
friend class ShortestPathExecutor;

void doReset(size_t pos) override;

Expand Down
11 changes: 8 additions & 3 deletions src/graph/context/ast/CypherAstContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ enum class CypherClauseKind : uint8_t {
kOrderBy,
kPagination,
kYield,
kShortestPath,
kAllShortestPaths,
};

enum class PatternKind : uint8_t {
Expand Down Expand Up @@ -80,6 +82,9 @@ struct Path final {
std::vector<std::string> compareVariables;
// "(v)-[:like]->()" in (v)-[:like]->()
std::string collectVariable;

enum PathType : int8_t { kDefault, kAllShortest, kSingleShortest };
PathType pathType{PathType::kDefault};
};

struct CypherClauseContextBase : AstContext {
Expand Down Expand Up @@ -210,8 +215,8 @@ struct NodeContext final : PatternContext {
QueryContext* qctx;
WhereClauseContext* bindWhereClause;
GraphSpaceID spaceId;
NodeInfo* info{nullptr};
nevermore3 marked this conversation as resolved.
Show resolved Hide resolved
std::unordered_set<std::string>* nodeAliasesAvailable;
NodeInfo* info;
std::unordered_set<std::string>* nodeAliasesAvailable{nullptr};

// Output fields
ScanInfo scanInfo;
Expand All @@ -227,7 +232,7 @@ struct EdgeContext final : PatternContext {
QueryContext* qctx;
WhereClauseContext* bindWhereClause;
GraphSpaceID spaceId;
EdgeInfo* info{nullptr};
nevermore3 marked this conversation as resolved.
Show resolved Hide resolved
EdgeInfo* info;

// Output fields
ScanInfo scanInfo;
Expand Down
4 changes: 4 additions & 0 deletions src/graph/executor/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,12 @@ nebula_add_library(
algo/BFSShortestPathExecutor.cpp
algo/MultiShortestPathExecutor.cpp
algo/ProduceAllPathsExecutor.cpp
algo/ShortestPathExecutor.cpp
algo/CartesianProductExecutor.cpp
algo/SubgraphExecutor.cpp
algo/ShortestPathBase.cpp
algo/SingleShortestPath.cpp
algo/BatchShortestPath.cpp
admin/AddHostsExecutor.cpp
admin/DropHostsExecutor.cpp
admin/SwitchSpaceExecutor.cpp
Expand Down
4 changes: 4 additions & 0 deletions src/graph/executor/Executor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
#include "graph/executor/algo/CartesianProductExecutor.h"
#include "graph/executor/algo/MultiShortestPathExecutor.h"
#include "graph/executor/algo/ProduceAllPathsExecutor.h"
#include "graph/executor/algo/ShortestPathExecutor.h"
#include "graph/executor/algo/SubgraphExecutor.h"
#include "graph/executor/logic/ArgumentExecutor.h"
#include "graph/executor/logic/LoopExecutor.h"
Expand Down Expand Up @@ -545,6 +546,9 @@ Executor *Executor::makeExecutor(QueryContext *qctx, const PlanNode *node) {
case PlanNode::Kind::kAlterSpace: {
return pool->add(new AlterSpaceExecutor(node, qctx));
}
case PlanNode::Kind::kShortestPath: {
return pool->add(new ShortestPathExecutor(node, qctx));
}
case PlanNode::Kind::kUnknown: {
LOG(FATAL) << "Unknown plan node kind " << static_cast<int32_t>(node->kind());
break;
Expand Down
Loading