mirror of https://github.com/apache/druid.git
fix end of month bug in PeriodDropRule as well
This commit is contained in:
parent
0543322c56
commit
a9b8d8f1ce
|
@ -56,7 +56,7 @@ public class PeriodDropRule extends DropRule
|
||||||
@Override
|
@Override
|
||||||
public boolean appliesTo(DataSegment segment, DateTime referenceTimestamp)
|
public boolean appliesTo(DataSegment segment, DateTime referenceTimestamp)
|
||||||
{
|
{
|
||||||
final Interval currInterval = new Interval(referenceTimestamp.minus(period), period);
|
final Interval currInterval = new Interval(period, referenceTimestamp);
|
||||||
return currInterval.contains(segment.getInterval());
|
return currInterval.contains(segment.getInterval());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -79,6 +79,13 @@ public class PeriodDropRuleTest
|
||||||
now
|
now
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
Assert.assertTrue(
|
||||||
|
rule.appliesTo(
|
||||||
|
builder.interval(new Interval(now.minusDays(1), now))
|
||||||
|
.build(),
|
||||||
|
now
|
||||||
|
)
|
||||||
|
);
|
||||||
Assert.assertFalse(
|
Assert.assertFalse(
|
||||||
rule.appliesTo(
|
rule.appliesTo(
|
||||||
builder.interval(new Interval(now.minusYears(1), now.minusDays(1)))
|
builder.interval(new Interval(now.minusYears(1), now.minusDays(1)))
|
||||||
|
|
Loading…
Reference in New Issue