Skip to content
Snippets Groups Projects
Unverified Commit 8b9cf0f5 authored by bright-starry-sky's avatar bright-starry-sky Committed by GitHub
Browse files

fixed bug for create tag|edge index (#296)


Co-authored-by: default avatardutor <440396+dutor@users.noreply.github.com>
parent 8fc153c7
No related branches found
No related tags found
No related merge requests found
......@@ -434,7 +434,7 @@ private:
std::vector<std::string> fields,
bool ifNotExists)
: CreateIndexNode(id, input,
Kind::kCreateEdge,
Kind::kCreateTagIndex,
std::move(tagName),
std::move(indexName),
std::move(fields),
......@@ -464,7 +464,7 @@ private:
std::vector<std::string> fields,
bool ifNotExists)
: CreateIndexNode(id, input,
Kind::kCreateEdge,
Kind::kCreateEdgeIndex,
std::move(edgeName),
std::move(indexName),
std::move(fields),
......
......@@ -321,10 +321,14 @@ Status CreateTagIndexValidator::validateImpl() {
auto status = Status::OK();
do {
auto schema = vctx_->getSchema(name_);
if (schema == nullptr) {
status = Status::Error("Tag %s not exist", name_.c_str());
break;
auto tagStatus = qctx_->schemaMng()->toTagID(space_.id, name_);
if (!tagStatus.ok()) {
return tagStatus.status();
}
auto schema_ = qctx_->schemaMng()->getTagSchema(space_.id, tagStatus.value());
if (schema_ == nullptr) {
return Status::Error("No schema found for '%s'", name_.c_str());
}
status = IndexUtil::validateColumns(fields_);
......@@ -359,10 +363,14 @@ Status CreateEdgeIndexValidator::validateImpl() {
auto status = Status::OK();
do {
auto schema = vctx_->getSchema(name_);
if (schema == nullptr) {
status = Status::Error("Edge %s not exist", name_.c_str());
break;
auto edgeStatus = qctx_->schemaMng()->toEdgeType(space_.id, name_);
if (!edgeStatus.ok()) {
return edgeStatus.status();
}
auto schema_ = qctx_->schemaMng()->getEdgeSchema(space_.id, edgeStatus.value());
if (schema_ == nullptr) {
return Status::Error("No schema found for '%s'", name_.c_str());
}
status = IndexUtil::validateColumns(fields_);
......
......@@ -164,8 +164,6 @@ std::unique_ptr<Validator> Validator::makeValidator(Sentence* sentence, QueryCon
return std::make_unique<ShowConfigsValidator>(sentence, context);
case Sentence::Kind::kFindPath:
return std::make_unique<FindPathValidator>(sentence, context);
case Sentence::Kind::kMatch:
case Sentence::Kind::kUnknown:
case Sentence::Kind::kCreateTagIndex:
return std::make_unique<CreateTagIndexValidator>(sentence, context);
case Sentence::Kind::kShowCreateTagIndex:
......@@ -190,6 +188,8 @@ std::unique_ptr<Validator> Validator::makeValidator(Sentence* sentence, QueryCon
return std::make_unique<RebuildEdgeIndexValidator>(sentence, context);
case Sentence::Kind::kDropEdgeIndex:
return std::make_unique<DropEdgeIndexValidator>(sentence, context);
case Sentence::Kind::kMatch:
case Sentence::Kind::kUnknown:
case Sentence::Kind::kLookup:
case Sentence::Kind::kDownload:
case Sentence::Kind::kIngest:
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment