-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Support Index Operations #1459
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
Merged
Merged
Support Index Operations #1459
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
e4ad61f
support index in query
darionyaphet 335476e
Merge branch 'master' into index-in-query-0
darionyaphet 3f9759d
Merge branch 'master' into index-in-query-0
darionyaphet 6864e34
Merge branch 'master' into index-in-query-0
darionyaphet 25b400a
Merge branch 'master' into index-in-query-0
0317e65
Merge branch 'master' into index-in-query-0
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/* Copyright (c) 2019 vesoft inc. All rights reserved. | ||
* | ||
* This source code is licensed under Apache 2.0 License, | ||
* attached with Common Clause Condition 1.0, found in the LICENSES directory. | ||
*/ | ||
|
||
#include "graph/BuildEdgeIndexExecutor.h" | ||
|
||
namespace nebula { | ||
namespace graph { | ||
|
||
BuildEdgeIndexExecutor::BuildEdgeIndexExecutor(Sentence *sentence, | ||
ExecutionContext *ectx) : Executor(ectx) { | ||
sentence_ = static_cast<BuildEdgeIndexSentence*>(sentence); | ||
} | ||
|
||
Status BuildEdgeIndexExecutor::prepare() { | ||
return Status::OK(); | ||
} | ||
|
||
void BuildEdgeIndexExecutor::execute() { | ||
auto status = checkIfGraphSpaceChosen(); | ||
if (!status.ok()) { | ||
DCHECK(onError_); | ||
onError_(std::move(status)); | ||
return; | ||
} | ||
|
||
auto *mc = ectx()->getMetaClient(); | ||
auto *name = sentence_->indexName(); | ||
auto spaceId = ectx()->rctx()->session()->space(); | ||
|
||
auto future = mc->buildEdgeIndex(spaceId, *name); | ||
auto *runner = ectx()->rctx()->runner(); | ||
auto cb = [this] (auto &&resp) { | ||
if (!resp.ok()) { | ||
DCHECK(onError_); | ||
onError_(resp.status()); | ||
return; | ||
} | ||
|
||
DCHECK(onFinish_); | ||
onFinish_(Executor::ProcessControl::kNext); | ||
}; | ||
|
||
auto error = [this] (auto &&e) { | ||
LOG(ERROR) << "Exception caught: " << e.what(); | ||
onError_(Status::Error("Internal error")); | ||
}; | ||
|
||
std::move(future).via(runner).thenValue(cb).thenError(error); | ||
} | ||
|
||
} // namespace graph | ||
} // namespace nebula |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* Copyright (c) 2019 vesoft inc. All rights reserved. | ||
* | ||
* This source code is licensed under Apache 2.0 License, | ||
* attached with Common Clause Condition 1.0, found in the LICENSES directory. | ||
*/ | ||
|
||
#ifndef GRAPH_BUILDEDGEINDEXEXECUTOR_H_ | ||
#define GRAPH_BUILDEDGEINDEXEXECUTOR_H_ | ||
|
||
#include "base/Base.h" | ||
#include "graph/Executor.h" | ||
|
||
namespace nebula { | ||
namespace graph { | ||
|
||
class BuildEdgeIndexExecutor final : public Executor { | ||
public: | ||
BuildEdgeIndexExecutor(Sentence *sentence, ExecutionContext *ectx); | ||
|
||
const char* name() const override { | ||
return "BuildEdgeIndexExecutor"; | ||
} | ||
|
||
Status MUST_USE_RESULT prepare() override; | ||
|
||
void execute() override; | ||
|
||
private: | ||
BuildEdgeIndexSentence *sentence_{nullptr}; | ||
}; | ||
|
||
} // namespace graph | ||
} // namespace nebula | ||
|
||
#endif // GRAPH_BUILDEDGEINDEXEXECUTOR_H_ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/* Copyright (c) 2019 vesoft inc. All rights reserved. | ||
* | ||
* This source code is licensed under Apache 2.0 License, | ||
* attached with Common Clause Condition 1.0, found in the LICENSES directory. | ||
*/ | ||
|
||
#include "graph/BuildTagIndexExecutor.h" | ||
|
||
namespace nebula { | ||
namespace graph { | ||
|
||
BuildTagIndexExecutor::BuildTagIndexExecutor(Sentence *sentence, | ||
ExecutionContext *ectx) : Executor(ectx) { | ||
sentence_ = static_cast<BuildTagIndexSentence*>(sentence); | ||
} | ||
|
||
Status BuildTagIndexExecutor::prepare() { | ||
return Status::OK(); | ||
} | ||
|
||
void BuildTagIndexExecutor::execute() { | ||
auto status = checkIfGraphSpaceChosen(); | ||
if (!status.ok()) { | ||
DCHECK(onError_); | ||
onError_(std::move(status)); | ||
return; | ||
} | ||
|
||
auto *mc = ectx()->getMetaClient(); | ||
auto *name = sentence_->indexName(); | ||
auto spaceId = ectx()->rctx()->session()->space(); | ||
|
||
auto future = mc->buildTagIndex(spaceId, *name); | ||
auto *runner = ectx()->rctx()->runner(); | ||
auto cb = [this] (auto &&resp) { | ||
if (!resp.ok()) { | ||
DCHECK(onError_); | ||
onError_(resp.status()); | ||
return; | ||
} | ||
|
||
DCHECK(onFinish_); | ||
onFinish_(Executor::ProcessControl::kNext); | ||
}; | ||
|
||
auto error = [this] (auto &&e) { | ||
LOG(ERROR) << "Exception caught: " << e.what(); | ||
onError_(Status::Error("Internal error")); | ||
}; | ||
|
||
std::move(future).via(runner).thenValue(cb).thenError(error); | ||
} | ||
|
||
} // namespace graph | ||
} // namespace nebula |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* Copyright (c) 2019 vesoft inc. All rights reserved. | ||
* | ||
* This source code is licensed under Apache 2.0 License, | ||
* attached with Common Clause Condition 1.0, found in the LICENSES directory. | ||
*/ | ||
|
||
#ifndef GRAPH_BUILDTAGINDEXEXECUTOR_H_ | ||
#define GRAPH_BUILDTAGINDEXEXECUTOR_H_ | ||
|
||
#include "base/Base.h" | ||
#include "graph/Executor.h" | ||
|
||
namespace nebula { | ||
namespace graph { | ||
|
||
class BuildTagIndexExecutor final : public Executor { | ||
public: | ||
BuildTagIndexExecutor(Sentence *sentence, ExecutionContext *ectx); | ||
|
||
const char* name() const override { | ||
return "BuildTagIndexExecutor"; | ||
} | ||
|
||
Status MUST_USE_RESULT prepare() override; | ||
|
||
void execute() override; | ||
|
||
private: | ||
BuildTagIndexSentence *sentence_{nullptr}; | ||
}; | ||
|
||
} // namespace graph | ||
} // namespace nebula | ||
|
||
#endif // GRAPH_BUILDTAGINDEXEXECUTOR_H_ | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
/* Copyright (c) 2019 vesoft inc. All rights reserved. | ||
* | ||
* This source code is licensed under Apache 2.0 License, | ||
* attached with Common Clause Condition 1.0, found in the LICENSES directory. | ||
*/ | ||
|
||
#include "graph/CreateEdgeIndexExecutor.h" | ||
|
||
namespace nebula { | ||
namespace graph { | ||
|
||
CreateEdgeIndexExecutor::CreateEdgeIndexExecutor(Sentence *sentence, | ||
ExecutionContext *ectx) : Executor(ectx) { | ||
sentence_ = static_cast<CreateEdgeIndexSentence*>(sentence); | ||
} | ||
|
||
Status CreateEdgeIndexExecutor::prepare() { | ||
return Status::OK(); | ||
} | ||
|
||
void CreateEdgeIndexExecutor::execute() { | ||
auto status = checkIfGraphSpaceChosen(); | ||
if (!status.ok()) { | ||
DCHECK(onError_); | ||
onError_(std::move(status)); | ||
return; | ||
} | ||
|
||
auto *mc = ectx()->getMetaClient(); | ||
const auto *name = sentence_->indexName(); | ||
auto *edgeName = sentence_->edgeName(); | ||
auto columns = sentence_->names(); | ||
auto spaceId = ectx()->rctx()->session()->space(); | ||
|
||
auto future = mc->createEdgeIndex(spaceId, | ||
*name, | ||
*edgeName, | ||
columns, | ||
sentence_->isIfNotExist()); | ||
auto *runner = ectx()->rctx()->runner(); | ||
auto cb = [this] (auto &&resp) { | ||
if (!resp.ok()) { | ||
DCHECK(onError_); | ||
onError_(resp.status()); | ||
return; | ||
} | ||
|
||
DCHECK(onFinish_); | ||
onFinish_(Executor::ProcessControl::kNext); | ||
}; | ||
|
||
auto error = [this] (auto &&e) { | ||
LOG(ERROR) << "Exception caught: " << e.what(); | ||
onError_(Status::Error("Internal error")); | ||
}; | ||
|
||
std::move(future).via(runner).thenValue(cb).thenError(error); | ||
} | ||
|
||
} // namespace graph | ||
} // namespace nebula | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* Copyright (c) 2019 vesoft inc. All rights reserved. | ||
* | ||
* This source code is licensed under Apache 2.0 License, | ||
* attached with Common Clause Condition 1.0, found in the LICENSES directory. | ||
*/ | ||
|
||
#ifndef GRAPH_CREATEEDGEINDEXEXECUTOR_H | ||
#define GRAPH_CREATEEDGEINDEXEXECUTOR_H | ||
|
||
#include "graph/Executor.h" | ||
|
||
namespace nebula { | ||
namespace graph { | ||
|
||
class CreateEdgeIndexExecutor final : public Executor { | ||
public: | ||
CreateEdgeIndexExecutor(Sentence *sentence, ExecutionContext *ectx); | ||
|
||
const char* name() const override { | ||
return "CreateEdgeIndexExecutor"; | ||
} | ||
|
||
Status MUST_USE_RESULT prepare() override; | ||
|
||
void execute() override; | ||
|
||
private: | ||
CreateEdgeIndexSentence *sentence_{nullptr}; | ||
}; | ||
|
||
} // namespace graph | ||
} // namespace nebula | ||
|
||
#endif // GRAPH_CREATEEDGEINDEXEXECUTOR_H | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
/* Copyright (c) 2019 vesoft inc. All rights reserved. | ||
* | ||
* This source code is licensed under Apache 2.0 License, | ||
* attached with Common Clause Condition 1.0, found in the LICENSES directory. | ||
*/ | ||
|
||
#include "graph/CreateTagIndexExecutor.h" | ||
|
||
namespace nebula { | ||
namespace graph { | ||
|
||
CreateTagIndexExecutor::CreateTagIndexExecutor(Sentence *sentence, | ||
ExecutionContext *ectx) : Executor(ectx) { | ||
sentence_ = static_cast<CreateTagIndexSentence*>(sentence); | ||
} | ||
|
||
Status CreateTagIndexExecutor::prepare() { | ||
return Status::OK(); | ||
} | ||
|
||
void CreateTagIndexExecutor::execute() { | ||
auto status = checkIfGraphSpaceChosen(); | ||
if (!status.ok()) { | ||
DCHECK(onError_); | ||
onError_(std::move(status)); | ||
return; | ||
} | ||
|
||
auto *mc = ectx()->getMetaClient(); | ||
auto *name = sentence_->indexName(); | ||
darionyaphet marked this conversation as resolved.
Show resolved
Hide resolved
|
||
auto *tagName = sentence_->tagName(); | ||
auto columns = sentence_->names(); | ||
auto spaceId = ectx()->rctx()->session()->space(); | ||
|
||
auto future = mc->createTagIndex(spaceId, | ||
*name, | ||
*tagName, | ||
columns, | ||
sentence_->isIfNotExist()); | ||
auto *runner = ectx()->rctx()->runner(); | ||
auto cb = [this] (auto &&resp) { | ||
if (!resp.ok()) { | ||
DCHECK(onError_); | ||
onError_(resp.status()); | ||
return; | ||
} | ||
|
||
DCHECK(onFinish_); | ||
onFinish_(Executor::ProcessControl::kNext); | ||
}; | ||
|
||
auto error = [this] (auto &&e) { | ||
LOG(ERROR) << "Exception caught: " << e.what(); | ||
onError_(Status::Error("Internal error")); | ||
}; | ||
|
||
std::move(future).via(runner).thenValue(cb).thenError(error); | ||
} | ||
|
||
} // namespace graph | ||
} // namespace nebula | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.