Skip to content

Query fails when using select *, followed/prefixed with explicit projections #13476

@findepi

Description

@findepi

Describe the bug

When doing interactive data exploration with wide tables/views with moderately expensive queries, it's very useful to run queries like

SELECT <important-columns, *
FROM ...
WHERE ...

This is useful because

  • whatever CLI/UI this is submitted over, the important columns are presented first by the presentation layer, making them easily accessible
  • should any additional information be needed, all the other columns are available, without re-running the query

This pattern unfortunately does not currently work in DataFusion

  • it's not possible to select all columns but put more important (from particular analysis perspective) columns first
  • as a result, a query needs to be run without * and whenever new column is needed, it needs to be re-run

To Reproduce

create table users (id int, name varchar, ........, registration_time timestamp);

select registration_time, id, * from users

Expected behavior

Query should succeed. It's valid ANSI SQL and supported by PostgreSQL, Trino, Snowflake, DuckDB, others

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions