提交 3bac3660 编写于 作者: X Xavier Léauté

handle NaN / Infinity values

上级 bed8860f
...@@ -88,6 +88,10 @@ public class DoubleSumAggregatorFactory implements AggregatorFactory ...@@ -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 ...@@ -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 ...@@ -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 ...@@ -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);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册