Merge pull request #498 from metamx/fix-nan-serde

handle NaN / Infinity values
This commit is contained in:
fjy 2014-04-22 12:17:29 -06:00
commit 44fec509dd
4 changed files with 10 additions and 0 deletions

View File

@ -88,6 +88,10 @@ public class DoubleSumAggregatorFactory implements AggregatorFactory
@Override
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;
}

View File

@ -139,6 +139,10 @@ public class JavaScriptAggregatorFactory implements AggregatorFactory
@Override
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;
}

View File

@ -85,6 +85,7 @@ public class MaxAggregatorFactory implements AggregatorFactory
@Override
public Object deserialize(Object object)
{
// handle "NaN" / "Infinity" values serialized as strings in JSON
if (object instanceof String) {
return Double.parseDouble((String) object);
}

View File

@ -85,6 +85,7 @@ public class MinAggregatorFactory implements AggregatorFactory
@Override
public Object deserialize(Object object)
{
// handle "NaN" / "Infinity" values serialized as strings in JSON
if (object instanceof String) {
return Double.parseDouble((String) object);
}