Skip to content

Extraction float64 value from JSON fails #18099

@cetver

Description

@cetver

Describe the bug
The JSONExtract functions can't extract the float64 value

How to reproduce

SELECT
    JSONExtract(json, 'value', 'String') str,
    JSONExtract(json, 'value', 'Float64') int,
    JSONExtractRaw(json) raw,
    type
FROM (
    SELECT '{"value":99999999999999999999}' json, 'float' type
    UNION ALL
    SELECT '{"value":"99999999999999999999"}' json, 'string' type
);
-- Float64
SELECT toTypeName(99999999999999999999);
  • Which ClickHouse server version to use
    20.11.4.13

Expected behavior

ACTUAL

+----------------------+-----+----------------------------------+--------+
| str                  | int | raw                              | type   |
+----------------------+-----+----------------------------------+--------+
|                      | 0   |                                  | float  |
+----------------------+-----+----------------------------------+--------+
| 99999999999999999999 | 0   | {"value":"99999999999999999999"} | string |
+----------------------+-----+----------------------------------+--------+

EXPECTED

+----------------------+----------------------+----------------------------------+--------+
| str                  | int                  | raw                              | type   |
+----------------------+----------------------+----------------------------------+--------+
| 99999999999999999999 | 99999999999999999999 | {"value":99999999999999999999}   | float  |
+----------------------+----------------------+----------------------------------+--------+
| 99999999999999999999 | 0                    | {"value":"99999999999999999999"} | string |
+----------------------+----------------------+----------------------------------+--------+

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions