asterixdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From buyin...@apache.org
Subject asterixdb git commit: [ASTERIXDB-2000][RT] Fix roundtrip-ability for INF in JSON format.
Date Thu, 27 Jul 2017 05:26:28 GMT
Repository: asterixdb
Updated Branches:
  refs/heads/master 2c1c263b0 -> d57d81ff9


[ASTERIXDB-2000][RT] Fix roundtrip-ability for INF in JSON format.

- user model changes: no
- storage format changes: no
- interface changes: no

Details:
- Use INF to represent infinity.

Change-Id: I13687822433744afe1ad3439029b2c0887563f9b
Reviewed-on: https://asterix-gerrit.ics.uci.edu/1901
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
BAD: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Yingyi Bu <buyingyi@gmail.com>


Project: http://git-wip-us.apache.org/repos/asf/asterixdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/asterixdb/commit/d57d81ff
Tree: http://git-wip-us.apache.org/repos/asf/asterixdb/tree/d57d81ff
Diff: http://git-wip-us.apache.org/repos/asf/asterixdb/diff/d57d81ff

Branch: refs/heads/master
Commit: d57d81ff9f843c58c811d9fe0854dd1de1d807b3
Parents: 2c1c263
Author: Yingyi Bu <yingyi@couchbase.com>
Authored: Wed Jul 26 15:46:32 2017 -0700
Committer: Yingyi Bu <buyingyi@gmail.com>
Committed: Wed Jul 26 22:25:41 2017 -0700

----------------------------------------------------------------------
 asterixdb/asterix-app/data/infinity.adm         |  1 +
 .../numeric/infinity/infinity.1.ddl.sqlpp       | 28 +++++++++++++
 .../numeric/infinity/infinity.2.update.sqlpp    | 22 ++++++++++
 .../numeric/infinity/infinity.3.query.sqlpp     | 23 +++++++++++
 .../constructor/double_01/double_01.1.adm       |  2 +-
 .../results/constructor/float_01/float_01.1.adm |  2 +-
 .../runtimets/results/numeric/abs2/abs2.1.adm   |  2 +-
 .../runtimets/results/numeric/abs3/abs3.1.adm   |  2 +-
 .../results/numeric/caret0/caret0.1.adm         |  2 +-
 .../results/numeric/ceiling2/ceiling2.1.adm     |  2 +-
 .../results/numeric/ceiling3/ceiling3.1.adm     |  2 +-
 .../results/numeric/floor2/floor2.1.adm         |  2 +-
 .../results/numeric/floor3/floor3.1.adm         |  2 +-
 .../results/numeric/infinity/infinity.1.adm     |  1 +
 .../runtimets/results/numeric/ln/ln.1.adm       |  2 +-
 .../runtimets/results/numeric/log/log.1.adm     |  2 +-
 .../numeric/non-finite/non-finite.1.json        |  4 +-
 .../round-half-to-even2.1.adm                   |  2 +-
 .../round-half-to-even22.1.adm                  |  2 +-
 .../round-half-to-even23.1.adm                  |  2 +-
 .../round-half-to-even3.1.adm                   |  2 +-
 .../unary-minus_double_02.1.adm                 |  2 +-
 .../unary-minus_float_02.1.adm                  |  2 +-
 .../resources/runtimets/testsuite_sqlpp.xml     |  5 +++
 .../asterix/external/parser/ADMDataParser.java  | 16 +++++++-
 .../src/main/resources/adm.grammar              |  4 +-
 .../data/nontagged/printers/PrintTools.java     | 42 ++++++++++++++++++++
 .../printers/adm/ADoublePrinterFactory.java     |  6 +--
 .../printers/adm/AFloatPrinterFactory.java      |  5 +--
 .../printers/csv/ADoublePrinterFactory.java     |  6 +--
 .../printers/csv/AFloatPrinterFactory.java      |  5 +--
 .../json/clean/ADoublePrinterFactory.java       | 14 ++-----
 .../json/clean/AFloatPrinterFactory.java        | 14 ++-----
 .../json/lossless/ADoublePrinterFactory.java    |  6 +--
 .../json/lossless/AFloatPrinterFactory.java     |  6 +--
 35 files changed, 179 insertions(+), 63 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/asterixdb/blob/d57d81ff/asterixdb/asterix-app/data/infinity.adm
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/data/infinity.adm b/asterixdb/asterix-app/data/infinity.adm
new file mode 100644
index 0000000..fd44c8f
--- /dev/null
+++ b/asterixdb/asterix-app/data/infinity.adm
@@ -0,0 +1 @@
+{ "id": 1, "a": INF, "b": -INF, "c":NaN }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/d57d81ff/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/numeric/infinity/infinity.1.ddl.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/numeric/infinity/infinity.1.ddl.sqlpp
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/numeric/infinity/infinity.1.ddl.sqlpp
new file mode 100644
index 0000000..7059c72
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/numeric/infinity/infinity.1.ddl.sqlpp
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+drop  dataverse test if exists;
+create  dataverse test;
+use test;
+
+create type test as {
+   id: int
+}
+
+create dataset test(test) primary key id;

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/d57d81ff/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/numeric/infinity/infinity.2.update.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/numeric/infinity/infinity.2.update.sqlpp
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/numeric/infinity/infinity.2.update.sqlpp
new file mode 100644
index 0000000..fd0f6ad
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/numeric/infinity/infinity.2.update.sqlpp
@@ -0,0 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use test;
+
+load dataset test using localfs ((`path`=`asterix_nc1://data/infinity.adm`),(`format`=`adm`));

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/d57d81ff/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/numeric/infinity/infinity.3.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/numeric/infinity/infinity.3.query.sqlpp
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/numeric/infinity/infinity.3.query.sqlpp
new file mode 100644
index 0000000..aeb2c0d
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/numeric/infinity/infinity.3.query.sqlpp
@@ -0,0 +1,23 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use test;
+
+
+select value test from test;

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/d57d81ff/asterixdb/asterix-app/src/test/resources/runtimets/results/constructor/double_01/double_01.1.adm
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/constructor/double_01/double_01.1.adm
b/asterixdb/asterix-app/src/test/resources/runtimets/results/constructor/double_01/double_01.1.adm
index ae7413d..0f1f5df 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results/constructor/double_01/double_01.1.adm
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/constructor/double_01/double_01.1.adm
@@ -1 +1 @@
-{ "double1": NaN, "double2": Infinity, "double3": -Infinity, "double4": -80.2, "double5":
-2.056E-29, "double6": -2.056E-299, "double7": -2.056E-299 }
+{ "double1": NaN, "double2": INF, "double3": -INF, "double4": -80.2, "double5": -2.056E-29,
"double6": -2.056E-299, "double7": -2.056E-299 }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/d57d81ff/asterixdb/asterix-app/src/test/resources/runtimets/results/constructor/float_01/float_01.1.adm
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/constructor/float_01/float_01.1.adm
b/asterixdb/asterix-app/src/test/resources/runtimets/results/constructor/float_01/float_01.1.adm
index 9acd764..722697d 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results/constructor/float_01/float_01.1.adm
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/constructor/float_01/float_01.1.adm
@@ -1 +1 @@
-{ "float1": NaN, "float2": Infinity, "float3": -Infinity, "float4": -80.2, "float5": -2.056E-29,
"float6": -2.056E-29 }
+{ "float1": NaN, "float2": INF, "float3": -INF, "float4": -80.2, "float5": -2.056E-29, "float6":
-2.056E-29 }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/d57d81ff/asterixdb/asterix-app/src/test/resources/runtimets/results/numeric/abs2/abs2.1.adm
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/numeric/abs2/abs2.1.adm
b/asterixdb/asterix-app/src/test/resources/runtimets/results/numeric/abs2/abs2.1.adm
index 22e50da..7429760 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results/numeric/abs2/abs2.1.adm
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/numeric/abs2/abs2.1.adm
@@ -1 +1 @@
-{ "f0": 20.1, "f1": 2.056E-29, "f2": NaN, "f3": Infinity, "f4": Infinity, "f5": 0.0, "f6":
0.0 }
+{ "f0": 20.1, "f1": 2.056E-29, "f2": NaN, "f3": INF, "f4": INF, "f5": -0.0, "f6": 0.0 }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/d57d81ff/asterixdb/asterix-app/src/test/resources/runtimets/results/numeric/abs3/abs3.1.adm
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/numeric/abs3/abs3.1.adm
b/asterixdb/asterix-app/src/test/resources/runtimets/results/numeric/abs3/abs3.1.adm
index f938327..c868b79 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results/numeric/abs3/abs3.1.adm
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/numeric/abs3/abs3.1.adm
@@ -1 +1 @@
-{ "d0": 20.1, "d1": 2.056E-29, "d2": NaN, "d3": Infinity, "d4": Infinity, "d5": 0.0, "d6":
0.0 }
+{ "d0": 20.1, "d1": 2.056E-29, "d2": NaN, "d3": INF, "d4": INF, "d5": -0.0, "d6": 0.0 }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/d57d81ff/asterixdb/asterix-app/src/test/resources/runtimets/results/numeric/caret0/caret0.1.adm
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/numeric/caret0/caret0.1.adm
b/asterixdb/asterix-app/src/test/resources/runtimets/results/numeric/caret0/caret0.1.adm
index 3d2b01c..bec02d6 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results/numeric/caret0/caret0.1.adm
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/numeric/caret0/caret0.1.adm
@@ -1 +1 @@
-{ "c1": Infinity, "c2": 1.6777216E7, "c3": 9 }
+{ "c1": INF, "c2": 1.6777216E7, "c3": 9 }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/d57d81ff/asterixdb/asterix-app/src/test/resources/runtimets/results/numeric/ceiling2/ceiling2.1.adm
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/numeric/ceiling2/ceiling2.1.adm
b/asterixdb/asterix-app/src/test/resources/runtimets/results/numeric/ceiling2/ceiling2.1.adm
index 0d2c59f..3311d2a 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results/numeric/ceiling2/ceiling2.1.adm
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/numeric/ceiling2/ceiling2.1.adm
@@ -1 +1 @@
-{ "f0": 21.0, "f1": -0.0, "f2": NaN, "f3": Infinity, "f4": -Infinity, "f5": -0.0, "f6": 0.0
}
+{ "f0": 21.0, "f1": -0.0, "f2": NaN, "f3": INF, "f4": -INF, "f5": -0.0, "f6": 0.0 }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/d57d81ff/asterixdb/asterix-app/src/test/resources/runtimets/results/numeric/ceiling3/ceiling3.1.adm
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/numeric/ceiling3/ceiling3.1.adm
b/asterixdb/asterix-app/src/test/resources/runtimets/results/numeric/ceiling3/ceiling3.1.adm
index 6d944b9..c81e935 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results/numeric/ceiling3/ceiling3.1.adm
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/numeric/ceiling3/ceiling3.1.adm
@@ -1 +1 @@
-{ "d0": 21.0, "d1": -0.0, "d2": NaN, "d3": Infinity, "d4": -Infinity, "d5": -0.0, "d6": 0.0
}
+{ "d0": 21.0, "d1": -0.0, "d2": NaN, "d3": INF, "d4": -INF, "d5": -0.0, "d6": 0.0 }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/d57d81ff/asterixdb/asterix-app/src/test/resources/runtimets/results/numeric/floor2/floor2.1.adm
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/numeric/floor2/floor2.1.adm
b/asterixdb/asterix-app/src/test/resources/runtimets/results/numeric/floor2/floor2.1.adm
index 9366300..9e493c2 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results/numeric/floor2/floor2.1.adm
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/numeric/floor2/floor2.1.adm
@@ -1 +1 @@
-{ "f0": 20.0, "f1": -1.0, "f2": NaN, "f3": Infinity, "f4": -Infinity, "f5": -0.0, "f6": 0.0
}
+{ "f0": 20.0, "f1": -1.0, "f2": NaN, "f3": INF, "f4": -INF, "f5": -0.0, "f6": 0.0 }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/d57d81ff/asterixdb/asterix-app/src/test/resources/runtimets/results/numeric/floor3/floor3.1.adm
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/numeric/floor3/floor3.1.adm
b/asterixdb/asterix-app/src/test/resources/runtimets/results/numeric/floor3/floor3.1.adm
index cb452ad..4322a51 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results/numeric/floor3/floor3.1.adm
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/numeric/floor3/floor3.1.adm
@@ -1 +1 @@
-{ "d0": 20.0, "d1": -1.0, "d2": NaN, "d3": Infinity, "d4": -Infinity, "d5": -0.0, "d6": 0.0
}
+{ "d0": 20.0, "d1": -1.0, "d2": NaN, "d3": INF, "d4": -INF, "d5": -0.0, "d6": 0.0 }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/d57d81ff/asterixdb/asterix-app/src/test/resources/runtimets/results/numeric/infinity/infinity.1.adm
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/numeric/infinity/infinity.1.adm
b/asterixdb/asterix-app/src/test/resources/runtimets/results/numeric/infinity/infinity.1.adm
new file mode 100644
index 0000000..8f7401a
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/numeric/infinity/infinity.1.adm
@@ -0,0 +1 @@
+{ "id": 1, "a": INF, "b": -INF, "c": NaN }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/d57d81ff/asterixdb/asterix-app/src/test/resources/runtimets/results/numeric/ln/ln.1.adm
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/numeric/ln/ln.1.adm
b/asterixdb/asterix-app/src/test/resources/runtimets/results/numeric/ln/ln.1.adm
index 598faa4..aa6439f 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results/numeric/ln/ln.1.adm
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/numeric/ln/ln.1.adm
@@ -1 +1 @@
-{ "a": 4.787491742782046, "b": 4.505349850705881, "c": 4.499809670330265, "d": -Infinity,
"e": NaN, "f": 0.0, "g": null }
+{ "a": 4.787491742782046, "b": 4.505349850705881, "c": 4.499809670330265, "d": -INF, "e":
NaN, "f": 0.0, "g": null }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/d57d81ff/asterixdb/asterix-app/src/test/resources/runtimets/results/numeric/log/log.1.adm
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/numeric/log/log.1.adm
b/asterixdb/asterix-app/src/test/resources/runtimets/results/numeric/log/log.1.adm
index 5280bf9..333cf3e 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results/numeric/log/log.1.adm
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/numeric/log/log.1.adm
@@ -1 +1 @@
-{ "a": 2.0791812460476247, "b": 1.9566485792052033, "c": 1.954242509439325, "d": -Infinity,
"e": NaN, "f": 0.0, "g": null }
+{ "a": 2.0791812460476247, "b": 1.9566485792052033, "c": 1.954242509439325, "d": -INF, "e":
NaN, "f": 0.0, "g": null }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/d57d81ff/asterixdb/asterix-app/src/test/resources/runtimets/results/numeric/non-finite/non-finite.1.json
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/numeric/non-finite/non-finite.1.json
b/asterixdb/asterix-app/src/test/resources/runtimets/results/numeric/non-finite/non-finite.1.json
index db5a90c..78d4801 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results/numeric/non-finite/non-finite.1.json
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/numeric/non-finite/non-finite.1.json
@@ -1,2 +1,2 @@
-[ { "NaN": "NaN", "Infinity": "Infinity", "-Infinity": "-Infinity" }
- ]
+[ { "NaN": "NaN", "Infinity": "INF", "-Infinity": "-INF" }
+ ]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/d57d81ff/asterixdb/asterix-app/src/test/resources/runtimets/results/numeric/round-half-to-even2/round-half-to-even2.1.adm
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/numeric/round-half-to-even2/round-half-to-even2.1.adm
b/asterixdb/asterix-app/src/test/resources/runtimets/results/numeric/round-half-to-even2/round-half-to-even2.1.adm
index 2371813..0c4af96 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results/numeric/round-half-to-even2/round-half-to-even2.1.adm
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/numeric/round-half-to-even2/round-half-to-even2.1.adm
@@ -1 +1 @@
-{ "f0": 0.0, "f1": -20.0, "f2": NaN, "f3": Infinity, "f4": -Infinity, "f5": -0.0, "f6": 0.0
}
+{ "f0": 0.0, "f1": -20.0, "f2": NaN, "f3": INF, "f4": -INF, "f5": -0.0, "f6": 0.0 }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/d57d81ff/asterixdb/asterix-app/src/test/resources/runtimets/results/numeric/round-half-to-even22/round-half-to-even22.1.adm
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/numeric/round-half-to-even22/round-half-to-even22.1.adm
b/asterixdb/asterix-app/src/test/resources/runtimets/results/numeric/round-half-to-even22/round-half-to-even22.1.adm
index ddc981b..0050d53 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results/numeric/round-half-to-even22/round-half-to-even22.1.adm
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/numeric/round-half-to-even22/round-half-to-even22.1.adm
@@ -1 +1 @@
-{ "d0": 0.56, "d1": 0.32, "d2": NaN, "d3": Infinity, "d4": -Infinity, "d5": -0.0, "d6": 0.0
}
+{ "d0": 0.56, "d1": 0.32, "d2": NaN, "d3": INF, "d4": -INF, "d5": -0.0, "d6": 0.0 }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/d57d81ff/asterixdb/asterix-app/src/test/resources/runtimets/results/numeric/round-half-to-even23/round-half-to-even23.1.adm
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/numeric/round-half-to-even23/round-half-to-even23.1.adm
b/asterixdb/asterix-app/src/test/resources/runtimets/results/numeric/round-half-to-even23/round-half-to-even23.1.adm
index ddc981b..0050d53 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results/numeric/round-half-to-even23/round-half-to-even23.1.adm
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/numeric/round-half-to-even23/round-half-to-even23.1.adm
@@ -1 +1 @@
-{ "d0": 0.56, "d1": 0.32, "d2": NaN, "d3": Infinity, "d4": -Infinity, "d5": -0.0, "d6": 0.0
}
+{ "d0": 0.56, "d1": 0.32, "d2": NaN, "d3": INF, "d4": -INF, "d5": -0.0, "d6": 0.0 }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/d57d81ff/asterixdb/asterix-app/src/test/resources/runtimets/results/numeric/round-half-to-even3/round-half-to-even3.1.adm
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/numeric/round-half-to-even3/round-half-to-even3.1.adm
b/asterixdb/asterix-app/src/test/resources/runtimets/results/numeric/round-half-to-even3/round-half-to-even3.1.adm
index 8b67144..a58f7bc 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results/numeric/round-half-to-even3/round-half-to-even3.1.adm
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/numeric/round-half-to-even3/round-half-to-even3.1.adm
@@ -1 +1 @@
-{ "d0": 0.0, "d1": -20.0, "d2": NaN, "d3": Infinity, "d4": -Infinity, "d5": -0.0, "d6": 0.0
}
+{ "d0": 0.0, "d1": -20.0, "d2": NaN, "d3": INF, "d4": -INF, "d5": -0.0, "d6": 0.0 }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/d57d81ff/asterixdb/asterix-app/src/test/resources/runtimets/results/numeric/unary-minus_double_02/unary-minus_double_02.1.adm
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/numeric/unary-minus_double_02/unary-minus_double_02.1.adm
b/asterixdb/asterix-app/src/test/resources/runtimets/results/numeric/unary-minus_double_02/unary-minus_double_02.1.adm
index 399b39c..f848687 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results/numeric/unary-minus_double_02/unary-minus_double_02.1.adm
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/numeric/unary-minus_double_02/unary-minus_double_02.1.adm
@@ -1 +1 @@
-{ "double1": 2.056E-29, "double2": NaN, "double3": -Infinity, "double4": Infinity }
+{ "double1": 2.056E-29, "double2": NaN, "double3": -INF, "double4": INF }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/d57d81ff/asterixdb/asterix-app/src/test/resources/runtimets/results/numeric/unary-minus_float_02/unary-minus_float_02.1.adm
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/numeric/unary-minus_float_02/unary-minus_float_02.1.adm
b/asterixdb/asterix-app/src/test/resources/runtimets/results/numeric/unary-minus_float_02/unary-minus_float_02.1.adm
index d47edae..c7fb8f2 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results/numeric/unary-minus_float_02/unary-minus_float_02.1.adm
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/numeric/unary-minus_float_02/unary-minus_float_02.1.adm
@@ -1 +1 @@
-{ "float1": 80.2, "float2": NaN, "float3": -Infinity, "float4": Infinity }
+{ "float1": 80.2, "float2": NaN, "float3": -INF, "float4": INF }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/d57d81ff/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml b/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml
index cd0355a..47c0529 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml
@@ -4508,6 +4508,11 @@
       </compilation-unit>
     </test-case>
     <test-case FilePath="numeric">
+      <compilation-unit name="infinity">
+        <output-dir compare="Text">infinity</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="numeric">
       <compilation-unit name="multiply_double">
         <output-dir compare="Text">multiply_double</output-dir>
       </compilation-unit>

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/d57d81ff/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/parser/ADMDataParser.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/parser/ADMDataParser.java
b/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/parser/ADMDataParser.java
index 44766ff..d964788 100644
--- a/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/parser/ADMDataParser.java
+++ b/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/parser/ADMDataParser.java
@@ -921,11 +921,23 @@ public class ADMDataParser extends AbstractDataParser implements IStreamDataPars
                 parseInt64(unquoted, out);
                 return true;
             case FLOAT:
-                aFloat.setValue(Float.parseFloat(unquoted));
+                if ("INF".equals(unquoted)) {
+                    aFloat.setValue(Float.POSITIVE_INFINITY);
+                } else if ("-INF".equals(unquoted)) {
+                    aFloat.setValue(Float.NEGATIVE_INFINITY);
+                } else {
+                    aFloat.setValue(Float.parseFloat(unquoted));
+                }
                 floatSerde.serialize(aFloat, out);
                 return true;
             case DOUBLE:
-                aDouble.setValue(Double.parseDouble(unquoted));
+                if ("INF".equals(unquoted)) {
+                    aDouble.setValue(Double.POSITIVE_INFINITY);
+                } else if ("-INF".equals(unquoted)) {
+                    aDouble.setValue(Double.NEGATIVE_INFINITY);
+                } else {
+                    aDouble.setValue(Double.parseDouble(unquoted));
+                }
                 doubleSerde.serialize(aDouble, out);
                 return true;
             case STRING:

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/d57d81ff/asterixdb/asterix-external-data/src/main/resources/adm.grammar
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-external-data/src/main/resources/adm.grammar b/asterixdb/asterix-external-data/src/main/resources/adm.grammar
index b4f5432..4de729f 100644
--- a/asterixdb/asterix-external-data/src/main/resources/adm.grammar
+++ b/asterixdb/asterix-external-data/src/main/resources/adm.grammar
@@ -83,8 +83,8 @@ DOUBLE_LITERAL       = signOrNothing(), digitSequence(), char(.), digitSequence(
 DOUBLE_LITERAL       = signOrNothing(), digitSequence(), char(.), digitSequence(), token(@EXPONENT)
 DOUBLE_LITERAL       = signOrNothing(), digitSequence(), token(@EXPONENT)
 DOUBLE_LITERAL       = string(NaN)
-DOUBLE_LITERAL       = string(Infinity)
-DOUBLE_LITERAL       = string(-Infinity)
+DOUBLE_LITERAL       = string(INF)
+DOUBLE_LITERAL       = string(-INF)
 
 DOUBLE_LITERAL       = token(DOUBLE_LITERAL), caseInsensitiveChar(d)
 FLOAT_LITERAL        = token(DOUBLE_LITERAL), caseInsensitiveChar(f)

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/d57d81ff/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/PrintTools.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/PrintTools.java
b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/PrintTools.java
index 5b5f53f..b1039a5 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/PrintTools.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/PrintTools.java
@@ -22,6 +22,8 @@ import java.io.IOException;
 import java.io.OutputStream;
 import java.io.PrintStream;
 
+import org.apache.asterix.dataflow.data.nontagged.serde.ADoubleSerializerDeserializer;
+import org.apache.asterix.dataflow.data.nontagged.serde.AFloatSerializerDeserializer;
 import org.apache.asterix.dataflow.data.nontagged.serde.AInt32SerializerDeserializer;
 import org.apache.asterix.dataflow.data.nontagged.serde.AInt64SerializerDeserializer;
 import org.apache.asterix.om.base.temporal.GregorianCalendarSystem;
@@ -215,6 +217,46 @@ public class PrintTools {
         }
     }
 
+    public static void printDoubleForJson(byte[] b, int s, PrintStream ps) throws HyracksDataException
{
+        final double d = ADoubleSerializerDeserializer.getDouble(b, s + 1);
+        if (Double.isFinite(d)) {
+            ps.print(d);
+        } else {
+            ps.append('"');
+            ps.print(Double.isNaN(d) ? "NaN" : (d == Double.POSITIVE_INFINITY) ? "INF" :
"-INF");
+            ps.append('"');
+        }
+    }
+
+    public static void printDouble(byte[] b, int s, PrintStream ps) throws HyracksDataException
{
+        final double d = ADoubleSerializerDeserializer.getDouble(b, s + 1);
+        if (Double.isFinite(d)) {
+            ps.print(d);
+        } else {
+            ps.print(Double.isNaN(d) ? "NaN" : (d == Double.POSITIVE_INFINITY) ? "INF" :
"-INF");
+        }
+    }
+
+    public static void printFloatForJson(byte[] b, int s, PrintStream ps) throws HyracksDataException
{
+        final float f = AFloatSerializerDeserializer.getFloat(b, s + 1);
+        if (Float.isFinite(f)) {
+            ps.print(f);
+        } else {
+            ps.print('"');
+            ps.print(Float.isNaN(f) ? "NaN" : (f == Float.POSITIVE_INFINITY) ? "INF" : "-INF");
+            ps.print('"');
+        }
+    }
+
+    public static void printFloat(byte[] b, int s, PrintStream ps) throws HyracksDataException
{
+        final float f = AFloatSerializerDeserializer.getFloat(b, s + 1);
+        if (Float.isFinite(f)) {
+            ps.print(f);
+        } else {
+            ps.print(Float.isNaN(f) ? "NaN" : (f == Float.POSITIVE_INFINITY) ? "INF" : "-INF");
+        }
+    }
+
     public enum CASE {
         LOWER_CASE,
         UPPER_CASE,

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/d57d81ff/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/adm/ADoublePrinterFactory.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/adm/ADoublePrinterFactory.java
b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/adm/ADoublePrinterFactory.java
index 15dbbbc..49455d5 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/adm/ADoublePrinterFactory.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/adm/ADoublePrinterFactory.java
@@ -20,7 +20,7 @@ package org.apache.asterix.dataflow.data.nontagged.printers.adm;
 
 import java.io.PrintStream;
 
-import org.apache.asterix.dataflow.data.nontagged.serde.ADoubleSerializerDeserializer;
+import org.apache.asterix.dataflow.data.nontagged.printers.PrintTools;
 import org.apache.hyracks.algebricks.data.IPrinter;
 import org.apache.hyracks.algebricks.data.IPrinterFactory;
 
@@ -29,8 +29,8 @@ public class ADoublePrinterFactory implements IPrinterFactory {
     private static final long serialVersionUID = 1L;
     public static final ADoublePrinterFactory INSTANCE = new ADoublePrinterFactory();
 
-    public static final IPrinter PRINTER = (byte[] b, int s, int l, PrintStream ps) ->
ps
-            .print(ADoubleSerializerDeserializer.getDouble(b, s + 1));
+    public static final IPrinter PRINTER = (byte[] b, int s, int l, PrintStream ps) ->
PrintTools.printDouble(b, s,
+            ps);
 
     @Override
     public IPrinter createPrinter() {

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/d57d81ff/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/adm/AFloatPrinterFactory.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/adm/AFloatPrinterFactory.java
b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/adm/AFloatPrinterFactory.java
index edf1e1d..3f5d4c2 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/adm/AFloatPrinterFactory.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/adm/AFloatPrinterFactory.java
@@ -20,7 +20,7 @@ package org.apache.asterix.dataflow.data.nontagged.printers.adm;
 
 import java.io.PrintStream;
 
-import org.apache.asterix.dataflow.data.nontagged.serde.AFloatSerializerDeserializer;
+import org.apache.asterix.dataflow.data.nontagged.printers.PrintTools;
 import org.apache.hyracks.algebricks.data.IPrinter;
 import org.apache.hyracks.algebricks.data.IPrinterFactory;
 
@@ -29,8 +29,7 @@ public class AFloatPrinterFactory implements IPrinterFactory {
     private static final long serialVersionUID = 1L;
     public static final AFloatPrinterFactory INSTANCE = new AFloatPrinterFactory();
 
-    public static final IPrinter PRINTER = (byte[] b, int s, int l, PrintStream ps) ->
ps
-            .print(AFloatSerializerDeserializer.getFloat(b, s + 1));
+    public static final IPrinter PRINTER = (byte[] b, int s, int l, PrintStream ps) ->
PrintTools.printFloat(b, s, ps);
 
     @Override
     public IPrinter createPrinter() {

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/d57d81ff/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/ADoublePrinterFactory.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/ADoublePrinterFactory.java
b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/ADoublePrinterFactory.java
index d08bae5..29f11c4 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/ADoublePrinterFactory.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/ADoublePrinterFactory.java
@@ -20,7 +20,7 @@ package org.apache.asterix.dataflow.data.nontagged.printers.csv;
 
 import java.io.PrintStream;
 
-import org.apache.asterix.dataflow.data.nontagged.serde.ADoubleSerializerDeserializer;
+import org.apache.asterix.dataflow.data.nontagged.printers.PrintTools;
 import org.apache.hyracks.algebricks.data.IPrinter;
 import org.apache.hyracks.algebricks.data.IPrinterFactory;
 
@@ -29,8 +29,8 @@ public class ADoublePrinterFactory implements IPrinterFactory {
     private static final long serialVersionUID = 1L;
     public static final ADoublePrinterFactory INSTANCE = new ADoublePrinterFactory();
 
-    public static final IPrinter PRINTER = (byte[] b, int s, int l, PrintStream ps) ->
ps
-            .print(ADoubleSerializerDeserializer.getDouble(b, s + 1));
+    public static final IPrinter PRINTER = (byte[] b, int s, int l, PrintStream ps) ->
PrintTools.printDouble(b, s,
+            ps);
 
     @Override
     public IPrinter createPrinter() {

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/d57d81ff/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/AFloatPrinterFactory.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/AFloatPrinterFactory.java
b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/AFloatPrinterFactory.java
index ed2c2f4..987ed8a 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/AFloatPrinterFactory.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/AFloatPrinterFactory.java
@@ -20,7 +20,7 @@ package org.apache.asterix.dataflow.data.nontagged.printers.csv;
 
 import java.io.PrintStream;
 
-import org.apache.asterix.dataflow.data.nontagged.serde.AFloatSerializerDeserializer;
+import org.apache.asterix.dataflow.data.nontagged.printers.PrintTools;
 import org.apache.hyracks.algebricks.data.IPrinter;
 import org.apache.hyracks.algebricks.data.IPrinterFactory;
 
@@ -29,8 +29,7 @@ public class AFloatPrinterFactory implements IPrinterFactory {
     private static final long serialVersionUID = 1L;
     public static final AFloatPrinterFactory INSTANCE = new AFloatPrinterFactory();
 
-    public static final IPrinter PRINTER = (byte[] b, int s, int l, PrintStream ps) ->
ps
-            .print(AFloatSerializerDeserializer.getFloat(b, s + 1));
+    public static final IPrinter PRINTER = (byte[] b, int s, int l, PrintStream ps) ->
PrintTools.printFloat(b, s, ps);
 
     @Override
     public IPrinter createPrinter() {

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/d57d81ff/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/ADoublePrinterFactory.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/ADoublePrinterFactory.java
b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/ADoublePrinterFactory.java
index abf9ced..2081162 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/ADoublePrinterFactory.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/ADoublePrinterFactory.java
@@ -20,7 +20,7 @@ package org.apache.asterix.dataflow.data.nontagged.printers.json.clean;
 
 import java.io.PrintStream;
 
-import org.apache.asterix.dataflow.data.nontagged.serde.ADoubleSerializerDeserializer;
+import org.apache.asterix.dataflow.data.nontagged.printers.PrintTools;
 import org.apache.hyracks.algebricks.data.IPrinter;
 import org.apache.hyracks.algebricks.data.IPrinterFactory;
 
@@ -29,16 +29,8 @@ public class ADoublePrinterFactory implements IPrinterFactory {
     private static final long serialVersionUID = 1L;
     public static final ADoublePrinterFactory INSTANCE = new ADoublePrinterFactory();
 
-    public static final IPrinter PRINTER = (byte[] b, int s, int l, PrintStream ps) ->
{
-        final double d = ADoubleSerializerDeserializer.getDouble(b, s + 1);
-        if (Double.isFinite(d)) {
-            ps.print(d);
-        } else {
-            ps.append('"');
-            ps.print(Double.toString(d));
-            ps.append('"');
-        }
-    };
+    public static final IPrinter PRINTER = (byte[] b, int s, int l, PrintStream ps) ->
PrintTools.printDoubleForJson(b,
+            s, ps);
 
     @Override
     public IPrinter createPrinter() {

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/d57d81ff/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/AFloatPrinterFactory.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/AFloatPrinterFactory.java
b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/AFloatPrinterFactory.java
index a6cdc0d..46ff2f7 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/AFloatPrinterFactory.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/AFloatPrinterFactory.java
@@ -20,7 +20,7 @@ package org.apache.asterix.dataflow.data.nontagged.printers.json.clean;
 
 import java.io.PrintStream;
 
-import org.apache.asterix.dataflow.data.nontagged.serde.AFloatSerializerDeserializer;
+import org.apache.asterix.dataflow.data.nontagged.printers.PrintTools;
 import org.apache.hyracks.algebricks.data.IPrinter;
 import org.apache.hyracks.algebricks.data.IPrinterFactory;
 
@@ -29,16 +29,8 @@ public class AFloatPrinterFactory implements IPrinterFactory {
     private static final long serialVersionUID = 1L;
     public static final AFloatPrinterFactory INSTANCE = new AFloatPrinterFactory();
 
-    public static final IPrinter PRINTER = (byte[] b, int s, int l, PrintStream ps) ->
{
-        final float aFloat = AFloatSerializerDeserializer.getFloat(b, s + 1);
-        if (Float.isFinite(aFloat)) {
-            ps.print(aFloat);
-        } else {
-            ps.append('"');
-            ps.print(Float.toString(aFloat));
-            ps.append('"');
-        }
-    };
+    public static final IPrinter PRINTER = (byte[] b, int s, int l, PrintStream ps) ->
PrintTools.printFloatForJson(b,
+            s, ps);
 
     @Override
     public IPrinter createPrinter() {

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/d57d81ff/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/lossless/ADoublePrinterFactory.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/lossless/ADoublePrinterFactory.java
b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/lossless/ADoublePrinterFactory.java
index a14a16f..5d74980 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/lossless/ADoublePrinterFactory.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/lossless/ADoublePrinterFactory.java
@@ -20,7 +20,7 @@ package org.apache.asterix.dataflow.data.nontagged.printers.json.lossless;
 
 import java.io.PrintStream;
 
-import org.apache.asterix.dataflow.data.nontagged.serde.ADoubleSerializerDeserializer;
+import org.apache.asterix.dataflow.data.nontagged.printers.PrintTools;
 import org.apache.hyracks.algebricks.data.IPrinter;
 import org.apache.hyracks.algebricks.data.IPrinterFactory;
 
@@ -29,8 +29,8 @@ public class ADoublePrinterFactory implements IPrinterFactory {
     private static final long serialVersionUID = 1L;
     public static final ADoublePrinterFactory INSTANCE = new ADoublePrinterFactory();
 
-    public static final IPrinter PRINTER = (byte[] b, int s, int l, PrintStream ps) ->
ps
-            .print(ADoubleSerializerDeserializer.getDouble(b, s + 1));
+    public static final IPrinter PRINTER = (byte[] b, int s, int l, PrintStream ps) ->
PrintTools.printDoubleForJson(b,
+            s, ps);
 
     @Override
     public IPrinter createPrinter() {

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/d57d81ff/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/lossless/AFloatPrinterFactory.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/lossless/AFloatPrinterFactory.java
b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/lossless/AFloatPrinterFactory.java
index 987dbd8..6ed3f98 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/lossless/AFloatPrinterFactory.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/lossless/AFloatPrinterFactory.java
@@ -20,7 +20,7 @@ package org.apache.asterix.dataflow.data.nontagged.printers.json.lossless;
 
 import java.io.PrintStream;
 
-import org.apache.asterix.dataflow.data.nontagged.serde.AFloatSerializerDeserializer;
+import org.apache.asterix.dataflow.data.nontagged.printers.PrintTools;
 import org.apache.hyracks.algebricks.data.IPrinter;
 import org.apache.hyracks.algebricks.data.IPrinterFactory;
 
@@ -29,8 +29,8 @@ public class AFloatPrinterFactory implements IPrinterFactory {
     private static final long serialVersionUID = 1L;
     public static final AFloatPrinterFactory INSTANCE = new AFloatPrinterFactory();
 
-    public static final IPrinter PRINTER = (byte[] b, int s, int l, PrintStream ps) ->
ps
-            .print(AFloatSerializerDeserializer.getFloat(b, s + 1));
+    public static final IPrinter PRINTER = (byte[] b, int s, int l, PrintStream ps) ->
PrintTools.printFloatForJson(b,
+            s, ps);
 
     @Override
     public IPrinter createPrinter() {


Mime
View raw message