LakshSingla commented on code in PR #15463:
URL: https://github.com/apache/druid/pull/15463#discussion_r1410403930
##########
processing/src/main/java/org/apache/druid/java/util/common/granularity/Granularity.java:
##########
@@ -253,29 +247,33 @@ public enum Formatter
private class IntervalIterable implements Iterable<Interval>
{
private final Interval inputInterval;
+ private final int limit;
- private IntervalIterable(Interval inputInterval)
+ private IntervalIterable(Interval inputInterval, int limit)
{
this.inputInterval = inputInterval;
+ this.limit = limit;
}
@Override
public Iterator<Interval> iterator()
{
- return new IntervalIterator(inputInterval);
+ return new IntervalIterator(inputInterval, limit);
}
}
private class IntervalIterator implements Iterator<Interval>
{
private final Interval inputInterval;
+ private int limit;
private long currStart;
private long currEnd;
- private IntervalIterator(Interval inputInterval)
+ private IntervalIterator(Interval inputInterval, int limit)
{
this.inputInterval = inputInterval;
+ this.limit = limit;
Review Comment:
We should add a precondition that it is positive and also an upper limit so
that a caller can't shortcut and use Integer.MAX_VALUE.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]