mirror of https://github.com/apache/druid.git
Fix BucketExtractionFn on objects that are strings. (#4072)
This commit is contained in:
parent
403fbae7b1
commit
3ec1877887
|
@ -60,7 +60,7 @@ public class BucketExtractionFn implements ExtractionFn
|
||||||
if (value instanceof Number) {
|
if (value instanceof Number) {
|
||||||
return bucket(((Number) value).doubleValue());
|
return bucket(((Number) value).doubleValue());
|
||||||
} else if (value instanceof String) {
|
} else if (value instanceof String) {
|
||||||
return apply(value);
|
return apply((String) value);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,6 +32,7 @@ public class BucketExtractionFnTest
|
||||||
public void testApply()
|
public void testApply()
|
||||||
{
|
{
|
||||||
BucketExtractionFn extractionFn1 = new BucketExtractionFn(100.0, 0.5);
|
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("1200.5", extractionFn1.apply("1234.99"));
|
||||||
Assert.assertEquals("0.5", extractionFn1.apply("1"));
|
Assert.assertEquals("0.5", extractionFn1.apply("1"));
|
||||||
Assert.assertEquals("0.5", extractionFn1.apply("100"));
|
Assert.assertEquals("0.5", extractionFn1.apply("100"));
|
||||||
|
|
Loading…
Reference in New Issue