ClickHouse / ClickHouse/ClickHouse

JSON Input Fails to convert `null` for a `Point` value to `nan`

Open
#111,917 1 comment 0 reactions 0 assignees View on GitHub
clickgap-analyzed comp-formats culprit-pr-not-found potential bug
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

Open the contributing 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.