Skip to content

Extend DESCRIBE statement to output the schema #16429

Open
@comphead

Description

@comphead

Is your feature request related to a problem or challenge?

I'm finding slightly confusing how to output the schema of particular query, the workaround I use is

> create table t1 as select map_extract(map([1], ['a']), 1)[1];
0 row(s) fetched. 
Elapsed 0.011 seconds.

> describe t1;
+---------------------------------------------------------------------------------+-----------+-------------+
| column_name                                                                     | data_type | is_nullable |
+---------------------------------------------------------------------------------+-----------+-------------+
| map_extract(map(make_array(Int64(1)),make_array(Utf8("a"))),Int64(1))[Int64(1)] | Utf8      | NO          |
+---------------------------------------------------------------------------------+-----------+-------------+
1 row(s) fetched. 
Elapsed 0.001 seconds.

it would be more clear to use something like in duck db

D describe select map_extract(map([1], ['a']), 1)[1];
┌────────────────────────────────────────────────────────────────────┬─────────────┬─────────┬─────────┬─────────┬─────────┐
│                            column_name                             │ column_type │  null   │   key   │ default │  extra  │
│                              varchar                               │   varchar   │ varchar │ varchar │ varchar │ varchar │
├────────────────────────────────────────────────────────────────────┼─────────────┼─────────┼─────────┼─────────┼─────────┤
│ map_extract("map"(main.list_value(1), main.list_value('a')), 1)[1] │ VARCHAR     │ YES     │         │         │         │
└────────────────────────────────────────────────────────────────────┴─────────────┴─────────┴─────────┴─────────┴─────────┘
D

Describe the solution you'd like

No response

Describe alternatives you've considered

No response

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