dentiny commented on PR #11725:
URL: https://github.com/apache/arrow-rs/pull/11725#issuecomment-6433927266

   > do we have evidence from other SQL systems such as Spark and DuckDB on how 
they treat this? having `NaN` and `Infinity` literals seems surprising to me, 
wasnt aware this was a thing in some JSON datasets
   
   Thanks @Jefffrey for the reply! I think DuckDB does support, for example
   ```sql
   DuckDB v2.0.0 (Cyanoptera)
   Enter ".help" for usage hints.
   memory D COPY (
                SELECT line FROM (VALUES
                    ('{"x":NaN}'),
                    ('{"x":Infinity}'),
                    ('{"x":-Infinity}'),
                    ('{"x":null}')
                ) AS t(line)
            ) TO '/tmp/nonfinite.jsonl'
              (FORMAT CSV, HEADER false, QUOTE '', ESCAPE '');
   
   memory D SELECT
                x,
                typeof(x) AS inferred_type,
                isnan(x) AS is_nan,
                isinf(x) AS is_infinite,
                x IS NULL AS is_null
            FROM read_json('/tmp/nonfinite.jsonl');
   ┌────────┬───────────────┬─────────┬─────────────┬─────────┐
   │   x    │ inferred_type │ is_nan  │ is_infinite │ is_null │
   │ double │    varchar    │ boolean │   boolean   │ boolean │
   ├────────┼───────────────┼─────────┼─────────────┼─────────┤
   │    nan │ DOUBLE        │ true    │ false       │ false   │
   │    inf │ DOUBLE        │ false   │ true        │ false   │
   │   -inf │ DOUBLE        │ false   │ true        │ false   │
   │   NULL │ DOUBLE        │ NULL    │ NULL        │ true    │
   └────────┴───────────────┴─────────┴─────────────┴─────────┘
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to