Skip to content

Commit

Permalink
Merge pull request #2925 from ingef/hotfix/infinitely-old-entities
Browse files Browse the repository at this point in the history
Infinitely old entities
  • Loading branch information
awildturtok authored Feb 14, 2023
2 parents fb7eb9c + 0d76ea7 commit b922dbd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,8 @@
@ToString(callSuper = true, of = "unit")
public class DateDistanceAggregator extends SingleColumnAggregator<Long> {

private final ChronoUnit unit;
private LocalDate reference;
private ChronoUnit unit;

private long result = Long.MAX_VALUE;
private boolean hit;

Expand All @@ -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 {
Expand All @@ -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);

Expand Down

0 comments on commit b922dbd

Please sign in to comment.