Skip to content

Implement nested identifier access ( "Nested identifiers not yet supported" ) #11445

@alamb

Description

@alamb

Is your feature request related to a problem or challenge?

This came up on discord: https://discord.com/channels/885562378132000778/885562378132000781/1261359404197089443

> create or replace view foo as select  {'field1': { 'subfield1': 'foo', subfield2: 'bar', subfield3: [10,20,30,40]}} as "the_column";
0 row(s) fetched.
Elapsed 0.001 seconds.

> select * from foo;
+-------------------------------------------------------------------------+
| the_column                                                              |
+-------------------------------------------------------------------------+
| {field1: {subfield1: foo, subfield2: bar, subfield3: [10, 20, 30, 40]}} |
+-------------------------------------------------------------------------+
1 row(s) fetched.
Elapsed 0.002 seconds.

> select the_column.field1.subfield3[2] from foo;
Internal error: Nested identifiers not yet supported for column foo.the_column.
This was likely caused by a bug in DataFusion's code and we would welcome that you file an bug report in our issue tracker

Describe the solution you'd like

The query should work and return 20

Describe alternatives you've considered

Single level access works fine:

> create or replace view foo as select { 'subfield1': 'foo', subfield2: 'bar', subfield3: [10,20,30,40]} as "field1" ;
0 row(s) fetched.
Elapsed 0.008 seconds.

> select * from foo;
+---------------------------------------------------------------+
| field1                                                        |
+---------------------------------------------------------------+
| {subfield1: foo, subfield2: bar, subfield3: [10, 20, 30, 40]} |
+---------------------------------------------------------------+
1 row(s) fetched.
Elapsed 0.003 seconds.

> select field1.subfield3[2] from foo;
+----------------------------------------------------+
| get_field(foo.field1, Utf8("subfield3"))[Int64(2)] |
+----------------------------------------------------+
| 20                                                 |
+----------------------------------------------------+
1 row(s) fetched.
Elapsed 0.002 seconds.

Additional context

No response

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions