diff --git a/src/query/plan/operator.cpp b/src/query/plan/operator.cpp index 68d894d34..e4f96b684 100644 --- a/src/query/plan/operator.cpp +++ b/src/query/plan/operator.cpp @@ -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) { diff --git a/tests/unit/interpreter.cpp b/tests/unit/interpreter.cpp index e3aab7959..679cff692 100644 --- a/tests/unit/interpreter.cpp +++ b/tests/unit/interpreter.cpp @@ -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;");