-
Notifications
You must be signed in to change notification settings - Fork 240
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve support for reading CSV and JSON floating-point values (#4637)
* Improve support for reading CSV and JSON floating-point values Signed-off-by: Andy Grove <[email protected]> * scalastyle and add comments * Fix resource leak Signed-off-by: Andy Grove <[email protected]> * Add file reader tests for JSON * more tests * docs update * ansi mode tests and bug fix Signed-off-by: Andy Grove <[email protected]> * add invalid float values so that ansi is covered correctly by the tests * add invalid floats to csv_test * Remove Nan/Inf values from simple_float_values.csv and enable overflow tests. Also update compatibility guide. Signed-off-by: Andy Grove <[email protected]> * move withResource to enclose for loop * fix test regression * change maxFloatDiff to 1e-6
- Loading branch information
Showing
13 changed files
with
171 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ "number": -3.141592 } | ||
{ "number": 3.141592 } | ||
{ "number": 0.0 } | ||
{ "number": -0.0 } | ||
{ "number": -3.4028234663852886e+38 } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ "number": "-3.141592" } | ||
{ "number": "3.141592" } | ||
{ "number": "-3.4028234663852886e+38" } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
"number" | ||
true | ||
false | ||
bad | ||
"bad" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ "number": true } | ||
{ "number": "not a float" } | ||
{ "number": "" } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,13 @@ | ||
"number" | ||
NaN | ||
Inf | ||
+Inf | ||
-Inf | ||
NAN | ||
nan | ||
INF | ||
+INF | ||
-INF | ||
Infinity | ||
+Infinity | ||
-Infinity |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ "number": "NaN" } | ||
{ "number": "Infinity" } | ||
{ "number": "-Infinity" } |
12 changes: 12 additions & 0 deletions
12
integration_tests/src/test/resources/nan_and_inf_edge_cases.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ "number": "NAN" } | ||
{ "number": "nan" } | ||
{ "number": "INF" } | ||
{ "number": "+INF" } | ||
{ "number": "-INF" } | ||
{ "number": INF } | ||
{ "number": +INF } | ||
{ "number": -INF } | ||
{ "number": "Inf" } | ||
{ "number": "+Inf" } | ||
{ "number": "-Inf" } | ||
{ "number": "+Infinity" } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters