Skip to content

json_type(...) with path does not return "NULL" #11804

Closed
@zenazn

Description

What happens?

When using JSONPointer or JSONPath syntax to get type information from a JSON value using the json_type(...) function, I get the following unexpected behavior:

.nullvalue ''
select json_type(JSON 'null') as type;
┌─────────┐
│  type   │
│ varchar │
├─────────┤
│ NULL    │
└─────────┘
select json_type(JSON '{"a": null}', '/a') as type;
┌─────────┐
│  type   │
│ varchar │
├─────────┤
│         │
└─────────┘
select json_type(JSON '{"a": null}', '$.a') as type;
┌─────────┐
│  type   │
│ varchar │
├─────────┤
│         │
└─────────┘

I would expect the string 'NULL' to be returned in each of the above situations

To Reproduce

See shell snippets above

OS:

OS X, Apple Silicon

DuckDB Version:

0.10.2

DuckDB Client:

shell

Full Name:

Carl Jackson

Affiliation:

Watershed

What is the latest build you tested with? If possible, we recommend testing with the latest nightly build.

I have tested with a stable release

Did you include all relevant data sets for reproducing the issue?

Not applicable - the reproduction does not require a data set

Did you include all code required to reproduce the issue?

  • Yes, I have

Did you include all relevant configuration (e.g., CPU architecture, Python version, Linux distribution) to reproduce the issue?

  • Yes, I have

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions