Skip to content

View should display table sort order when present #18267

@NGA-TRAN

Description

@NGA-TRAN

Describe the bug

When I use select * from information_schema.views; to display the definition of my table, the WITH ORDER(...) is not included.

To Reproduce

In datafusion-cli

-- Not sorted
CREATE EXTERNAL TABLE  dimension_csv
STORED AS CSV 
LOCATION '/path/to/the/attached/dimension_1.csv'
OPTIONS ('format.has_header' 'true');

-- Sorted
CREATE EXTERNAL TABLE  dimension_csv_sorted
STORED AS CSV 
WITH ORDER (env, service, host)
LOCATION '/path/to/the/attached/dimension_1.csv'
OPTIONS ('format.has_header' 'true');

The information_schema.views does not display WITH ORDER (env, service, host) for table dimension_csv_sorted

select * from information_schema.views;

+---------------+--------------+--------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| table_catalog | table_schema | table_name               | definition                                                                                                                                                         |
+---------------+--------------+--------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| datafusion    | public       | dimension_csv_sorted     | CREATE EXTERNAL TABLE dimension_csv_sorted STORED AS CSV LOCATION /path/to/the/attached/dimension_1.csv              |
| datafusion    | public       | dimension_csv            | CREATE EXTERNAL TABLE dimension_csv STORED AS CSV LOCATION /path/to/the/attached/dimension_1.csv                     |
+---------------+--------------+--------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------+

[dimension_1.csv](https://github.com/user-attachments/files/23124138/dimension_1.csv

Expected behavior

No response

Additional context

No response

Metadata

Metadata

Labels

bugSomething isn't working

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions