Fix BucketExtractionFn on objects that are strings. (#4072)

This commit is contained in:
Gian Merlino 2017-03-16 22:59:11 -07:00 committed by Jonathan Wei
parent 403fbae7b1
commit 3ec1877887
2 changed files with 4 additions and 3 deletions

View File

@ -60,7 +60,7 @@ public class BucketExtractionFn implements ExtractionFn
if (value instanceof Number) {
return bucket(((Number) value).doubleValue());
} else if (value instanceof String) {
return apply(value);
return apply((String) value);
}
return null;
}

View File

@ -32,6 +32,7 @@ public class BucketExtractionFnTest
public void testApply()
{
BucketExtractionFn extractionFn1 = new BucketExtractionFn(100.0, 0.5);
Assert.assertEquals("1200.5", extractionFn1.apply((Object) "1234.99"));
Assert.assertEquals("1200.5", extractionFn1.apply("1234.99"));
Assert.assertEquals("0.5", extractionFn1.apply("1"));
Assert.assertEquals("0.5", extractionFn1.apply("100"));