Fix missing statistics for SetPropertiesCursor (#1460)
This commit is contained in:
parent
58648d1a70
commit
f4b97fc03d
@ -2896,6 +2896,8 @@ void SetPropertiesOnRecord(TRecordAccessor *record, const TypedValue &rhs, SetPr
|
||||
|
||||
auto update_props = [&, record](PropertiesMap &new_properties) {
|
||||
auto updated_properties = UpdatePropertiesChecked(record, new_properties);
|
||||
// NOLINTNEXTLINE(bugprone-narrowing-conversions,cppcoreguidelines-narrowing-conversions)
|
||||
context->execution_stats[ExecutionStats::Key::UPDATED_PROPERTIES] += new_properties.size();
|
||||
|
||||
if (should_register_change) {
|
||||
for (const auto &[id, old_value, new_value] : updated_properties) {
|
||||
|
@ -27,6 +27,7 @@
|
||||
#include "query/exceptions.hpp"
|
||||
#include "query/interpreter.hpp"
|
||||
#include "query/interpreter_context.hpp"
|
||||
#include "query/metadata.hpp"
|
||||
#include "query/stream.hpp"
|
||||
#include "query/typed_value.hpp"
|
||||
#include "query_common.hpp"
|
||||
@ -1274,6 +1275,24 @@ TYPED_TEST(InterpreterTest, ExecutionStatsValues) {
|
||||
}
|
||||
}
|
||||
|
||||
TYPED_TEST(InterpreterTest, ExecutionStatsValuesPropertiesSet) {
|
||||
{
|
||||
auto [stream, qid] = this->Prepare(
|
||||
"CREATE (u:Employee {Uid: 'EMP_AAAAA', FirstName: 'Bong', LastName: 'Revilla'}) RETURN u.name AS name;");
|
||||
this->Pull(&stream);
|
||||
}
|
||||
{
|
||||
auto [stream, qid] = this->Prepare(
|
||||
"MATCH (node:Employee) WHERE node.Uid='EMP_AAAAA' SET node={FirstName: 'James', LastName: 'Revilla', Uid: "
|
||||
"'EMP_AAAAA', CreatedOn: 'null', CreatedBy: 'null', LastModifiedOn: '1698226931701', LastModifiedBy: 'null', "
|
||||
"Description: 'null'};");
|
||||
this->Pull(&stream);
|
||||
auto stats = stream.GetSummary().at("stats").ValueMap();
|
||||
auto key = memgraph::query::ExecutionStatsKeyToString(memgraph::query::ExecutionStats::Key::UPDATED_PROPERTIES);
|
||||
ASSERT_EQ(stats[key].ValueInt(), 8);
|
||||
}
|
||||
}
|
||||
|
||||
TYPED_TEST(InterpreterTest, NotificationsValidStructure) {
|
||||
{
|
||||
auto [stream, qid] = this->Prepare("MATCH (n) DELETE n;");
|
||||
|
Loading…
Reference in New Issue
Block a user