Skip to content

Commit

Permalink
go sentence support integer/timestamp type to start traverse. (vesoft…
Browse files Browse the repository at this point in the history
…-inc#2225)

Co-authored-by: trippli <trippli@tencent.com>
Co-authored-by: dangleptr <37216992+dangleptr@users.noreply.github.com>
  • Loading branch information
3 people committed Jul 21, 2020
1 parent 3f603e5 commit c20c54f
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/graph/InterimResult.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -191,11 +191,14 @@ InterimResult::buildIndex(const std::string &vidColumn) const {
auto name = schema->getFieldName(i);
if (vidColumn == name) {
VLOG(1) << "col name: " << vidColumn << ", col index: " << i;
if (schema->getFieldType(i).type != SupportedType::VID) {
if (schema->getFieldType(i).type != SupportedType::INT &&
schema->getFieldType(i).type != SupportedType::VID &&
schema->getFieldType(i).type != SupportedType::TIMESTAMP) {
return Status::Error(
"Build internal index for input data failed. "
"The specific vid column `%s' is not type of VID, column index: %ul.",
vidColumn.c_str(), i);
"Build internal index for input data failed. "
"The specific vid column `%s' is not type of VID, INT or TIMESTAMP, "
"column index: %u.",
vidColumn.c_str(), i);
}
vidIndex = i;
}
Expand Down Expand Up @@ -256,6 +259,9 @@ InterimResult::buildIndex(const std::string &vidColumn) const {
if (rc != ResultType::SUCCEEDED) {
return Status::Error("Get int from interim failed.");
}
if (i == vidIndex) {
index->vidToRowIndex_.emplace(v, rowIndex++);
}
row.emplace_back(v);
break;
}
Expand Down
17 changes: 17 additions & 0 deletions src/graph/test/GoTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,23 @@ TEST_P(GoTest, OneStepOutBound) {
};
ASSERT_TRUE(verifyResult(resp, expected));
}
{
cpp2::ExecutionResponse resp;
auto *fmt = "YIELD %ld as vid | GO FROM $-.vid OVER serve";
auto query = folly::stringPrintf(fmt, players_["Tim Duncan"].vid());
auto code = client_->execute(query, resp);
ASSERT_EQ(cpp2::ErrorCode::SUCCEEDED, code);

std::vector<std::string> expectedColNames{
{"serve._dst"}
};
ASSERT_TRUE(verifyColNames(resp, expectedColNames));

std::vector<std::tuple<int64_t>> expected = {
{teams_["Spurs"].vid()},
};
ASSERT_TRUE(verifyResult(resp, expected));
}
{
cpp2::ExecutionResponse resp;
auto &player = players_["Boris Diaw"];
Expand Down

0 comments on commit c20c54f

Please sign in to comment.