mirror of https://github.com/apache/druid.git
Merge pull request #498 from metamx/fix-nan-serde
handle NaN / Infinity values
This commit is contained in:
commit
44fec509dd
|
@ -88,6 +88,10 @@ public class DoubleSumAggregatorFactory implements AggregatorFactory
|
||||||
@Override
|
@Override
|
||||||
public Object deserialize(Object object)
|
public Object deserialize(Object object)
|
||||||
{
|
{
|
||||||
|
// handle "NaN" / "Infinity" values serialized as strings in JSON
|
||||||
|
if (object instanceof String) {
|
||||||
|
return Double.parseDouble((String) object);
|
||||||
|
}
|
||||||
return object;
|
return object;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -139,6 +139,10 @@ public class JavaScriptAggregatorFactory implements AggregatorFactory
|
||||||
@Override
|
@Override
|
||||||
public Object deserialize(Object object)
|
public Object deserialize(Object object)
|
||||||
{
|
{
|
||||||
|
// handle "NaN" / "Infinity" values serialized as strings in JSON
|
||||||
|
if (object instanceof String) {
|
||||||
|
return Double.parseDouble((String) object);
|
||||||
|
}
|
||||||
return object;
|
return object;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -85,6 +85,7 @@ public class MaxAggregatorFactory implements AggregatorFactory
|
||||||
@Override
|
@Override
|
||||||
public Object deserialize(Object object)
|
public Object deserialize(Object object)
|
||||||
{
|
{
|
||||||
|
// handle "NaN" / "Infinity" values serialized as strings in JSON
|
||||||
if (object instanceof String) {
|
if (object instanceof String) {
|
||||||
return Double.parseDouble((String) object);
|
return Double.parseDouble((String) object);
|
||||||
}
|
}
|
||||||
|
|
|
@ -85,6 +85,7 @@ public class MinAggregatorFactory implements AggregatorFactory
|
||||||
@Override
|
@Override
|
||||||
public Object deserialize(Object object)
|
public Object deserialize(Object object)
|
||||||
{
|
{
|
||||||
|
// handle "NaN" / "Infinity" values serialized as strings in JSON
|
||||||
if (object instanceof String) {
|
if (object instanceof String) {
|
||||||
return Double.parseDouble((String) object);
|
return Double.parseDouble((String) object);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue