Skip to content

Commit

Permalink
Fix fetch vertex missing type (vesoft-inc#2389)
Browse files Browse the repository at this point in the history
Co-authored-by: Yee <2520865+yixinglu@users.noreply.github.com>
  • Loading branch information
laura-ding and yixinglu authored Dec 2, 2020
1 parent f163ebc commit 3434739
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/graph/FetchVerticesExecutor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ void FetchVerticesExecutor::processResult(RpcResponse &&result) {
yieldColsHolder_.addColumn(column);
yields_.emplace_back(column);
colNames_.emplace_back(expr->toString());
colTypes_.emplace_back(nebula::cpp2::SupportedType::UNKNOWN);
colTypes_.emplace_back(iter->getType().type);
}
}
}
Expand Down
43 changes: 43 additions & 0 deletions src/graph/test/SchemaTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1339,5 +1339,48 @@ TEST_F(SchemaTest, issue2009) {
}
}

TEST_F(SchemaTest, fetchWithTimestamp) {
auto client = gEnv->getClient();
ASSERT_NE(nullptr, client);
{
cpp2::ExecutionResponse resp;
std::string query = "CREATE SPACE fetchWithTimestamp; USE fetchWithTimestamp;"
"CREATE TAG tag_timestamp(`create` timestamp);"
"CREATE EDGE edge_timestamp(`create` timestamp);";
auto code = client->execute(query, resp);
ASSERT_EQ(code, cpp2::ErrorCode::SUCCEEDED);
}
::sleep(FLAGS_heartbeat_interval_secs + 1);
{
cpp2::ExecutionResponse resp;
std::string query = "INSERT VERTEX tag_timestamp (`create`) VALUES 111:(now());"
"INSERT EDGE edge_timestamp (`create`) VALUES 111->222:(now());";
auto code = client->execute(query, resp);
ASSERT_EQ(code, cpp2::ErrorCode::SUCCEEDED);
}
{
cpp2::ExecutionResponse resp;
std::string query = "FETCH PROP ON tag_timestamp 111;";
auto code = client->execute(query, resp);
ASSERT_EQ(code, cpp2::ErrorCode::SUCCEEDED);
ASSERT_EQ(resp.get_rows()->size(), 1);
ASSERT_TRUE(resp.get_rows() != nullptr);
ASSERT_EQ((*resp.get_rows())[0].get_columns().size(), 2);
ASSERT_EQ((*resp.get_rows())[0].get_columns()[1].getType(),
cpp2::ColumnValue::Type::timestamp);
}
{
cpp2::ExecutionResponse resp;
std::string query = "FETCH PROP ON edge_timestamp 111->222;";
auto code = client->execute(query, resp);
ASSERT_EQ(code, cpp2::ErrorCode::SUCCEEDED);
ASSERT_TRUE(resp.get_rows() != nullptr);
ASSERT_EQ(resp.get_rows()->size(), 1);
ASSERT_EQ((*resp.get_rows())[0].get_columns().size(), 4);
ASSERT_EQ((*resp.get_rows())[0].get_columns()[3].getType(),
cpp2::ColumnValue::Type::timestamp);
}
}

} // namespace graph
} // namespace nebula

0 comments on commit 3434739

Please sign in to comment.