Skip to content

Dot notation for json field extraction is no longer working in v1.1.* #14167

@fanyang01

Description

@fanyang01

What happens?

SELECT columns.v4_c6 FROM read_ndjson_auto(...) is no longer working in DuckDB v1.1.* for the following JSON structure:

{"location":"67/820/data/1777410541745082368/854288f7-7e80-40ea-b43f-64e382462e74.dat","columns":{"v4_c21":{"statistics":{"nonNullCount":"0"}},"v4_c23":{"statistics":{"nonNullCount":"0"}},"v4_c22":{"statistics":{"nonNullCount":"0"}},"v4_c29":{"statistics":{"nonNullCount":"0"}},"v4_c6":{"statistics":{"nonNullCount":"0"}}, ...}}

DuckDB CLI and duckdb-java report the following error:

Binder Error: Cannot extract field 'v4_c6' from expression "columns" because it is not a struct, union, or json

My current workaround is switching to the bracket notation: SELECT columns['v4_c6'].

To Reproduce

4128-3fcd48a5-2c6f-4536-ac6d-1dfb837d8094.json

$ duckdb
v1.1.1 af39bd0dcf
Enter ".help" for usage hints.
Connected to a transient in-memory database.
Use ".open FILENAME" to reopen on a persistent database.
D select columns.v4_c6 from read_ndjson_auto('4128-3fcd48a5-2c6f-4536-ac6d-1dfb837d8094.json');
Binder Error: Cannot extract field 'v4_c6' from expression "columns" because it is not a struct, union, or json
D select "columns"."v4_c6" from read_ndjson_auto('4128-3fcd48a5-2c6f-4536-ac6d-1dfb837d8094.json');
Binder Error: Cannot extract field 'v4_c6' from expression "columns" because it is not a struct, union, or json
D select columns['v4_c6'] from read_ndjson_auto('4128-3fcd48a5-2c6f-4536-ac6d-1dfb837d8094.json');
┌─────────────────────────────────────────────────────┐
│                 "columns"['v4_c6']                  │
│ struct("statistics" struct(nonnullcount varchar))[] │
├─────────────────────────────────────────────────────┤
│ [{'statistics': {'nonNullCount': 0}}]               │
└─────────────────────────────────────────────────────┘

OS:

macOS aarch64

DuckDB Version:

1.1.1

DuckDB Client:

CLI, Java

Hardware:

No response

Full Name:

Fan Yang

Affiliation:

ApeCloud

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?

Yes

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

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