diff --git a/backend/src/main/java/com/bakdata/conquery/models/query/filter/event/DateDistanceFilterNode.java b/backend/src/main/java/com/bakdata/conquery/models/query/filter/event/DateDistanceFilterNode.java index 97527208f4..71bb0c9a04 100644 --- a/backend/src/main/java/com/bakdata/conquery/models/query/filter/event/DateDistanceFilterNode.java +++ b/backend/src/main/java/com/bakdata/conquery/models/query/filter/event/DateDistanceFilterNode.java @@ -39,7 +39,7 @@ public DateDistanceFilterNode(Column column, ChronoUnit unit, Range.LongRange fi @Override public void nextTable(QueryExecutionContext ctx, Table currentTable) { - if(ctx.getDateRestriction().isAll() || ctx.getDateRestriction().isEmpty()){ + if (CDate.isPositiveInfinity(ctx.getDateRestriction().getMaxValue()) || ctx.getDateRestriction().isEmpty()) { reference = LocalDate.now(); } else { diff --git a/backend/src/main/java/com/bakdata/conquery/models/query/queryplan/aggregators/specific/DateDistanceAggregator.java b/backend/src/main/java/com/bakdata/conquery/models/query/queryplan/aggregators/specific/DateDistanceAggregator.java index 8f91fcf184..70809fd828 100644 --- a/backend/src/main/java/com/bakdata/conquery/models/query/queryplan/aggregators/specific/DateDistanceAggregator.java +++ b/backend/src/main/java/com/bakdata/conquery/models/query/queryplan/aggregators/specific/DateDistanceAggregator.java @@ -19,9 +19,8 @@ @ToString(callSuper = true, of = "unit") public class DateDistanceAggregator extends SingleColumnAggregator { + private final ChronoUnit unit; private LocalDate reference; - private ChronoUnit unit; - private long result = Long.MAX_VALUE; private boolean hit; @@ -38,7 +37,7 @@ public void init(Entity entity, QueryExecutionContext context) { @Override public void nextTable(QueryExecutionContext ctx, Table currentTable) { - if(ctx.getDateRestriction().isAll() || ctx.getDateRestriction().isEmpty()){ + if (CDate.isPositiveInfinity(ctx.getDateRestriction().getMaxValue()) || ctx.getDateRestriction().isEmpty()) { reference = CDate.toLocalDate(ctx.getToday()); } else { @@ -53,13 +52,13 @@ public Long createAggregationResult() { @Override public void acceptEvent(Bucket bucket, int event) { - if(!bucket.has(event, getColumn())) { + if (!bucket.has(event, getColumn())) { return; } hit = true; - LocalDate date = CDate.toLocalDate(bucket.getDate(event, getColumn())); + final LocalDate date = CDate.toLocalDate(bucket.getDate(event, getColumn())); final long between = unit.between(date, reference);