diff --git a/src/graph/FetchVerticesExecutor.cpp b/src/graph/FetchVerticesExecutor.cpp index ae97498b450..d0920ac68f3 100644 --- a/src/graph/FetchVerticesExecutor.cpp +++ b/src/graph/FetchVerticesExecutor.cpp @@ -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); } } } diff --git a/src/graph/test/SchemaTest.cpp b/src/graph/test/SchemaTest.cpp index b1ab7338860..e1414aae9c8 100644 --- a/src/graph/test/SchemaTest.cpp +++ b/src/graph/test/SchemaTest.cpp @@ -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