Skip to content

Commit

Permalink
third revision
Browse files Browse the repository at this point in the history
  • Loading branch information
JackChuengQAQ committed Oct 28, 2024
1 parent 83fb894 commit 96d43e4
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 43 deletions.
34 changes: 0 additions & 34 deletions src/graph/executor/mutate/UpdateExecutor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,31 +13,6 @@ using nebula::storage::StorageClient;
namespace nebula {
namespace graph {

StatusOr<DataSet> UpdateBaseExecutor::handleResult(DataSet &&data) {
if (data.colNames.size() <= 1) {
if (yieldNames_.empty()) {
return Status::OK();
}
return Status::Error("Empty return props");
}

if (yieldNames_.size() != data.colNames.size() - 1) {
LOG(WARNING) << "Expect colName size is " << yieldNames_.size() << ", return colName size is "
<< data.colNames.size() - 1;
return Status::Error("Wrong return prop size");
}
DataSet result;
result.colNames = yieldNames_;
for (auto &row : data.rows) {
std::vector<Value> columns;
for (auto i = 1u; i < row.values.size(); i++) {
columns.emplace_back(std::move(row.values[i]));
}
result.rows.emplace_back(std::move(columns));
}
return result;
}

Status UpdateBaseExecutor::handleMultiResult(DataSet &result, DataSet &&data) {
if (data.colNames.size() <= 1) {
if (yieldNames_.empty()) {
Expand Down Expand Up @@ -72,12 +47,6 @@ folly::Future<Status> UpdateVertexExecutor::execute() {

if (vidRef != nullptr) {
auto inputVar = urvNode->inputVar();
if (inputVar.empty()) {
DCHECK(urvNode->dep() != nullptr);
auto *gn = static_cast<const SingleInputNode *>(urvNode->dep())->dep();
DCHECK(gn != nullptr);
inputVar = static_cast<const SingleInputNode *>(gn)->inputVar();
}
DCHECK(!inputVar.empty());
auto &inputResult = ectx_->getResult(inputVar);
auto iter = inputResult.iter();
Expand Down Expand Up @@ -188,9 +157,6 @@ folly::Future<Status> UpdateEdgeExecutor::execute() {
QueryExpressionContext ctx(ectx_);
for (; iter->valid(); iter->next()) {
auto srcId = Expression::eval(edgeKeyRef->srcid(), ctx(iter.get()));
if (srcId.isNull() || srcId.empty()) {
continue;
}
if (!SchemaUtil::isValidVid(srcId, *spaceInfo.spaceDesc.vid_type_ref())) {
std::stringstream ss;
ss << "Wrong srcId type `" << srcId.type() << "`, value `" << srcId.toString() << "'";
Expand Down
2 changes: 0 additions & 2 deletions src/graph/executor/mutate/UpdateExecutor.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ class UpdateBaseExecutor : public StorageAccessExecutor {
virtual ~UpdateBaseExecutor() {}

protected:
StatusOr<DataSet> handleResult(DataSet &&data);

Status handleMultiResult(DataSet &result, DataSet &&data);

protected:
Expand Down
3 changes: 0 additions & 3 deletions src/graph/validator/MutateValidator.h
Original file line number Diff line number Diff line change
Expand Up @@ -206,9 +206,6 @@ class UpdateEdgeValidator final : public UpdateValidator {
Status buildEdgeKeyRef();

private:
Value srcId_;
Value dstId_;
EdgeRanking rank_{0};
EdgeType edgeType_{-1};

std::vector<EdgeId> edgeIds_;
Expand Down
8 changes: 4 additions & 4 deletions src/graph/validator/test/MutateValidatorTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ TEST_F(MutateValidatorTest, UpdateVertexTest) {
"SET person.age = $^.person.age + 1 "
"WHEN $^.person.age == 18 "
"YIELD $^.person.name AS name, $^.person.age AS age";
ASSERT_TRUE(checkResult(cmd, {PK::kUpdateVertex, PK::kStart}));
ASSERT_TRUE(checkResult(cmd, {PK::kUpdateVertex, PK::kDedup, PK::kStart}));
}
// 2.0 syntax succeed
{
Expand All @@ -195,7 +195,7 @@ TEST_F(MutateValidatorTest, UpdateVertexTest) {
"SET age = age + 1 "
"WHEN age == 18 "
"YIELD name AS name, age AS age";
ASSERT_TRUE(checkResult(cmd, {PK::kUpdateVertex, PK::kStart}));
ASSERT_TRUE(checkResult(cmd, {PK::kUpdateVertex, PK::kDedup, PK::kStart}));
}
}

Expand All @@ -221,7 +221,7 @@ TEST_F(MutateValidatorTest, UpdateEdgeTest) {
"SET end = like.end + 1 "
"WHEN like.start >= 2010 "
"YIELD like.start AS start, like.end AS end";
ASSERT_TRUE(checkResult(cmd, {PK::kUpdateEdge, PK::kUpdateEdge, PK::kStart}));
ASSERT_TRUE(checkResult(cmd, {PK::kUpdateEdge, PK::kDedup, PK::kStart}));
}
// 2.0 syntax succeed
{
Expand All @@ -230,7 +230,7 @@ TEST_F(MutateValidatorTest, UpdateEdgeTest) {
"SET end = end + 1 "
"WHEN start >= 2010 "
"YIELD start AS start, end AS end";
ASSERT_TRUE(checkResult(cmd, {PK::kUpdateEdge, PK::kUpdateEdge, PK::kStart}));
ASSERT_TRUE(checkResult(cmd, {PK::kUpdateEdge, PK::kDedup, PK::kStart}));
}
}
} // namespace graph
Expand Down

0 comments on commit 96d43e4

Please sign in to comment.