File tree Expand file tree Collapse file tree 2 files changed +15
-2
lines changed
main/java/org/opensearch/search/aggregations/bucket/histogram
test/java/org/opensearch/search/aggregations/bucket Expand file tree Collapse file tree 2 files changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -227,12 +227,12 @@ public HistogramAggregationBuilder offset(double offset) {
227
227
228
228
/** Get the current minimum bound that is set on this builder. */
229
229
public double minBound () {
230
- return extendedBounds . getMin ( );
230
+ return DoubleBounds . getEffectiveMin ( extendedBounds );
231
231
}
232
232
233
233
/** Get the current maximum bound that is set on this builder. */
234
234
public double maxBound () {
235
- return extendedBounds . getMax ( );
235
+ return DoubleBounds . getEffectiveMax ( extendedBounds );
236
236
}
237
237
238
238
protected DoubleBounds extendedBounds () {
Original file line number Diff line number Diff line change @@ -103,6 +103,19 @@ public void testInvalidBounds() {
103
103
assertThat (ex .getMessage (), equalTo ("max bound [0.4] must be greater than min bound [0.5]" ));
104
104
}
105
105
106
+ /**
107
+ * Check that minBound/maxBound does not throw {@link NullPointerException} when called before being set.
108
+ */
109
+ public void testMinBoundMaxBoundDefaultValues () {
110
+ HistogramAggregationBuilder factory = new HistogramAggregationBuilder ("foo" );
111
+
112
+ double minValue = factory .minBound ();
113
+ double maxValue = factory .maxBound ();
114
+
115
+ assertThat (minValue , equalTo (Double .POSITIVE_INFINITY ));
116
+ assertThat (maxValue , equalTo (Double .NEGATIVE_INFINITY ));
117
+ }
118
+
106
119
private List <BucketOrder > randomOrder () {
107
120
List <BucketOrder > orders = new ArrayList <>();
108
121
switch (randomInt (4 )) {
You can’t perform that action at this time.
0 commit comments