Files
impala/testdata/workloads/functional-query/queries/QueryTest/overflow_json.test
Eyizoha 4e8555031b IMPALA-12957: Support reading Inf and NaN from JSON
Despite the fact that special values such as Inf and NaN are not
supported in standard JSON (they are considered invalid values),
rapidjson does support them. However, it requires the parsing flag
'kParseNanAndInfFlag' to be enabled.
This patch enables the flag to allows JsonParser to parse special
numbers like Inf and NaN. Corresponding modifications have also been
made to JsonSkipper to maintain consistent behavior when zero slots
scans.
Additionally, due to a minor issue in rapidjson v1.1.0 when parsing Inf
and NaN, this patch also updates the rapidjson version to include the
corresponding fix (see https://gerrit.cloudera.org/#/c/21980/).

Testing:
  - Added and passed relevant test cases (BE, E2E).

Change-Id: I05ee7c7c7fb7e78fff9570f659ce2d13c94a4e10
Reviewed-on: http://gerrit.cloudera.org:8080/21701
Reviewed-by: Impala Public Jenkins <impala-public-jenkins@cloudera.com>
Tested-by: Impala Public Jenkins <impala-public-jenkins@cloudera.com>
2024-11-11 00:09:08 +00:00

30 lines
1.1 KiB
Plaintext

====
---- QUERY
# Tests overflow of numeric in JSON. In JSON, numeric can be stored as either number or
# string types. Due to limitations in RapidJSON, numeric values that overflow will result
# in a parsing error (kParseErrorNumberTooBig), even when using the
# kParseNumbersAsStringsFlag. This parsing error is difficult to recover from, so we can
# only fill it with NULL and report the error. However, for numbers stored as strings,
# there is no such limitation, and they can be passed to the TextConverter for further
# processing.
select tinyint_col, smallint_col, int_col, bigint_col, float_col, double_col from overflow_json
---- TYPES
tinyint, smallint, int, bigint, float, double
---- RESULTS
1,2,3,4,5.5,6.6
127,32767,2147483647,9223372036854775807,NULL,NULL
-128,-32768,-2147483648,-9223372036854775808,NULL,NULL
1,2,3,4,5.5,6.6
127,32767,2147483647,9223372036854775807,Infinity,Infinity
-128,-32768,-2147483648,-9223372036854775808,-Infinity,-Infinity
NULL,NULL,NULL,NULL,NaN,NaN
NULL,NULL,NULL,NULL,Infinity,-Infinity
NULL,NULL,NULL,NULL,Infinity,-Infinity
====
---- QUERY
select count(*) from overflow_json
---- TYPES
bigint
---- RESULTS
9
====