Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/event multiple delete lastdatadelete #2357

Merged
merged 6 commits into from
Mar 8, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGES_NEXT_RELEASE
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
- [cygnus-ngsi][Column-aggregagor] FIx lastdata when remove multiple entities by alterationType with entityDelete
fgalan marked this conversation as resolved.
Show resolved Hide resolved
- [cygnus-ngsi][ColumnAggregator][LastData] Fix error when remove old values in lastData which does not exist (i.e. creating and updating entities)
Original file line number Diff line number Diff line change
Expand Up @@ -266,11 +266,20 @@ public void aggregate(NGSIEvent event) {
setLastDataTimestamp(currentTS);
for (String key : aggregation.keySet()) {
ArrayList<JsonElement> valueLastData = new ArrayList<>();
if (lastData.containsKey(key)) {
valueLastData = lastData.get(key);
} else if (!lastData.containsKey(key)){
valueLastData = new ArrayList<JsonElement>(Collections.nCopies(numPreviousValues, null));
if (lastDataEntityDelete) {
if (lastDataDelete.containsKey(key)) {
valueLastData = lastDataDelete.get(key);
} else if (!lastDataDelete.containsKey(key)){
valueLastData = new ArrayList<JsonElement>(Collections.nCopies(numPreviousValues, null));
}
} else {
if (lastData.containsKey(key)) {
valueLastData = lastData.get(key);
} else if (!lastData.containsKey(key)) {
valueLastData = new ArrayList<JsonElement>(Collections.nCopies(numPreviousValues, null));
}
}

valueLastData.add(aggregation.get(key).get(aggregation.get(key).size() - 1));
if (lastDataEntityDelete) {
lastDataDelete.put(key, valueLastData);
Expand Down
Loading