Skip to content

Commit

Permalink
chore: add example in validator
Browse files Browse the repository at this point in the history
  • Loading branch information
Triple-Z committed Dec 13, 2021
1 parent 7482cb5 commit 9e28dfa
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/graph/validator/MaintainValidator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,15 @@ static Status checkColName(const std::vector<ColumnSpecification *> specs) {

Status CreateFunctionValidator::validateImpl() {
// TODO(TripleZ): add create function logic
auto sentence = static_cast<CreateFunctionSentence *>(sentence_);
auto name = *sentence->name();
auto functionSource = *sentence->getFunctionSource();
auto funcType = functionSource.getType();
auto funcSource = functionSource.getSource();

std::cout << " => create function: name(" + name + "), type(" +
funcType + "), source(" + funcSource + ")" << std::endl;

return Status::OK();
}

Expand Down Expand Up @@ -278,6 +287,10 @@ Status DropFunctionValidator::validateImpl() { return Status::OK(); }

Status DropFunctionValidator::toPlan() {
// TODO(TripleZ): add drop function logic
auto sentence = static_cast<DropFunctionSentence *>(sentence_);
auto name = *sentence->name();
std::cout << " => drop function: name(" + name + ")" << std::endl;

return Status::OK();
}

Expand Down
8 changes: 8 additions & 0 deletions src/parser/MaintainSentences.h
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,14 @@ class FunctionSource final {
return source_;
}

std::string getType() const {
return type_;
}

std::string getSource() const {
return source_;
}

private:
std::string type_;
std::string source_;
Expand Down

0 comments on commit 9e28dfa

Please sign in to comment.