-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* disable modify same col * add test case * refactor ddl * fix pytest error * address comment Co-authored-by: Yee <2520865+yixinglu@users.noreply.github.com>
- Loading branch information
1 parent
3747894
commit 32db50a
Showing
17 changed files
with
361 additions
and
221 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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,66 @@ | ||
/* Copyright (c) 2021 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/planner/ngql/MaintainPlanner.h" | ||
|
||
#include "graph/context/ast/QueryAstContext.h" | ||
#include "graph/planner/plan/Maintain.h" | ||
|
||
namespace nebula { | ||
namespace graph { | ||
|
||
StatusOr<SubPlan> CreateTagPlanner::transform(AstContext* astCtx) { | ||
auto createCtx = static_cast<CreateSchemaContext*>(astCtx); | ||
SubPlan plan; | ||
plan.root = plan.tail = CreateTag::make(createCtx->qctx, | ||
nullptr, | ||
std::move(createCtx->name), | ||
std::move(createCtx->schema), | ||
createCtx->ifNotExist); | ||
return plan; | ||
} | ||
|
||
StatusOr<SubPlan> CreateEdgePlanner::transform(AstContext* astCtx) { | ||
auto createCtx = static_cast<CreateSchemaContext*>(astCtx); | ||
SubPlan plan; | ||
plan.root = plan.tail = CreateEdge::make(createCtx->qctx, | ||
nullptr, | ||
std::move(createCtx->name), | ||
std::move(createCtx->schema), | ||
createCtx->ifNotExist); | ||
return plan; | ||
} | ||
|
||
StatusOr<SubPlan> AlterTagPlanner::transform(AstContext* astCtx) { | ||
auto alterCtx = static_cast<AlterSchemaContext*>(astCtx); | ||
auto qctx = alterCtx->qctx; | ||
auto name = *static_cast<const AlterTagSentence*>(alterCtx->sentence)->name(); | ||
SubPlan plan; | ||
plan.root = plan.tail = AlterTag::make(qctx, | ||
nullptr, | ||
alterCtx->space.id, | ||
std::move(name), | ||
std::move(alterCtx->schemaItems), | ||
std::move(alterCtx->schemaProps)); | ||
return plan; | ||
} | ||
|
||
StatusOr<SubPlan> AlterEdgePlanner::transform(AstContext* astCtx) { | ||
auto alterCtx = static_cast<AlterSchemaContext*>(astCtx); | ||
auto qctx = alterCtx->qctx; | ||
auto name = *static_cast<const AlterEdgeSentence*>(alterCtx->sentence)->name(); | ||
SubPlan plan; | ||
plan.root = plan.tail = AlterEdge::make(qctx, | ||
nullptr, | ||
alterCtx->space.id, | ||
std::move(name), | ||
std::move(alterCtx->schemaItems), | ||
std::move(alterCtx->schemaProps)); | ||
return plan; | ||
} | ||
|
||
} // namespace graph | ||
} // namespace nebula |
This file contains 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) 2021 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. | ||
*/ | ||
#pragma once | ||
|
||
#include "common/base/Base.h" | ||
#include "graph/planner/Planner.h" | ||
#include "graph/planner/plan/PlanNode.h" | ||
|
||
namespace nebula { | ||
namespace graph { | ||
|
||
struct AstContext; | ||
|
||
class CreateTagPlanner final : public Planner { | ||
public: | ||
static std::unique_ptr<CreateTagPlanner> make() { | ||
return std::unique_ptr<CreateTagPlanner>(new CreateTagPlanner()); | ||
} | ||
static bool match(AstContext* astCtx) { | ||
return astCtx->sentence->kind() == Sentence::Kind::kCreateTag; | ||
} | ||
StatusOr<SubPlan> transform(AstContext* astCtx) override; | ||
}; | ||
|
||
class CreateEdgePlanner final : public Planner { | ||
public: | ||
static std::unique_ptr<CreateEdgePlanner> make() { | ||
return std::unique_ptr<CreateEdgePlanner>(new CreateEdgePlanner()); | ||
} | ||
static bool match(AstContext* astCtx) { | ||
return astCtx->sentence->kind() == Sentence::Kind::kCreateEdge; | ||
} | ||
StatusOr<SubPlan> transform(AstContext* astCtx) override; | ||
}; | ||
|
||
class AlterTagPlanner final : public Planner { | ||
public: | ||
static std::unique_ptr<AlterTagPlanner> make() { | ||
return std::unique_ptr<AlterTagPlanner>(new AlterTagPlanner()); | ||
} | ||
static bool match(AstContext* astCtx) { | ||
return astCtx->sentence->kind() == Sentence::Kind::kAlterTag; | ||
} | ||
StatusOr<SubPlan> transform(AstContext* astCtx) override; | ||
}; | ||
|
||
class AlterEdgePlanner final : public Planner { | ||
public: | ||
static std::unique_ptr<AlterEdgePlanner> make() { | ||
return std::unique_ptr<AlterEdgePlanner>(new AlterEdgePlanner()); | ||
} | ||
static bool match(AstContext* astCtx) { | ||
return astCtx->sentence->kind() == Sentence::Kind::kAlterEdge; | ||
} | ||
StatusOr<SubPlan> transform(AstContext* astCtx) override; | ||
}; | ||
|
||
} // namespace graph | ||
} // namespace nebula |
This file contains 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 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 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
Oops, something went wrong.