From aa84bb459b50483c2597dfe50355a5de42a6829e Mon Sep 17 00:00:00 2001 From: Martin Raifer Date: Tue, 19 Jan 2021 11:53:12 +0100 Subject: [PATCH] make sure groupByEntity is called before filters are set --- .../ohsome/ohsomeapi/executor/DataRequestExecutor.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/lombok/org/heigit/ohsome/ohsomeapi/executor/DataRequestExecutor.java b/src/main/lombok/org/heigit/ohsome/ohsomeapi/executor/DataRequestExecutor.java index 2a1777f6..d47749fc 100644 --- a/src/main/lombok/org/heigit/ohsome/ohsomeapi/executor/DataRequestExecutor.java +++ b/src/main/lombok/org/heigit/ohsome/ohsomeapi/executor/DataRequestExecutor.java @@ -101,9 +101,10 @@ public void extract() throws Exception { String endTimestamp = IsoDateTimeParser.parseIsoDateTime(requestParameters.getTime()[1]) .format(DateTimeFormatter.ISO_DATE_TIME); MapReducer> mapRedContributions = mapRedContribution.groupByEntity(); + MapReducer> mapRedSnapshots = mapRedSnapshot.groupByEntity(); Optional filter = processingData.getFilterExpression(); if (filter.isPresent()) { - mapRedSnapshot = mapRedSnapshot.filter(filter.get()); + mapRedSnapshots = mapRedSnapshots.filter(filter.get()); mapRedContributions = mapRedContributions.filter(filter.get()); } final boolean isContainingSimpleFeatureTypes = processingData.isContainingSimpleFeatureTypes(); @@ -124,8 +125,7 @@ public void extract() throws Exception { MapReducer snapshotPreResult = null; if (!isContributionsEndpoint) { // handles cases where valid_from = t_start, valid_to = t_end; i.e. non-modified data - snapshotPreResult = mapRedSnapshot - .groupByEntity() + snapshotPreResult = mapRedSnapshots .filter(snapshots -> snapshots.size() == 2) .filter(snapshots -> snapshots.get(0).getGeometry() == snapshots.get(1).getGeometry() && snapshots.get(0).getEntity().getVersion() == snapshots.get(1).getEntity()