ClickHouse / ClickHouse/ClickHouse
JSON Input Fails to convert `null` for a `Point` value to `nan`
- Dominant language
- C++
- Stars
- 49.9k
- Forks
- 9k
- Avg merge
- 21h 32m
- Merged PRs (30d)
- 515
Description
### Company or project name
ClickHouse
### Describe what's wrong
JSON parsing data into a `Point` converts `[11, null]` to `(11,0)` but should convert it to `(11,nan`).
### Does it reproduce on the most recent release?
Yes
### How to reproduce
TSV works correctly:
```sql
INSERT INTO FUNCTION file('test.tsv', 'TSV', 'a Point')
SETTINGS engine_file_truncate_on_insert = 1
FORMAT TSV
(11,NaN)
SELECT * FROM file('test.tsv', 'TSV', 'a Point');
```
Output:
```
(11,nan)
```
But JSON does not:
```sql
INSERT INTO FUNCTION file('test.json', 'JSON', 'a Point')
SETTINGS engine_file_truncate_on_insert = 1
FORMAT TSV
(11,NaN)
SELECT * FROM file('test.json', 'JSON', 'a Point');
```
Output:
```
(11,0)
```
Note that the value stored in `test.json` is `[11, null]`, so the reader ought to know to convert the null to nan.
### Expected behavior
_No response_
### Error message and/or stacktrace
_No response_
### Related issues and pull requests
_No response_
### Additional context
Also fails for these formats:
* JSON
* JSONColumns
* JSONColumnsWithMetadata
* JSONCompact
* JSONCompactColumns
* JSONEachRow
* JSONCompactEachRow
* JSONCompactEachRowWithNames
* JSONCompactEachRowWithNamesAndTypes
* JSONObjectEachRow
Contributor guide
Research direction
Start by reproducing the issue with the provided ClickHouse SQL and compare JSON input with the TSV result for a Point value. Trace the JSON readers for Point values, including JSONEachRow and the other listed formats; done means [11, null] is stored and returned as (11,nan) consistently.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, json, sql
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 64/100