Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support (order by / sort) for DataFrameWriteOptions #13873

Open
zhuqi-lucas opened this issue Dec 21, 2024 · 2 comments · May be fixed by #13874
Open

Support (order by / sort) for DataFrameWriteOptions #13873

zhuqi-lucas opened this issue Dec 21, 2024 · 2 comments · May be fixed by #13874
Assignees
Labels
enhancement New feature or request

Comments

@zhuqi-lucas
Copy link
Contributor

zhuqi-lucas commented Dec 21, 2024

Is your feature request related to a problem or challenge?

DataFrameWriteOptions is missing an order by / sort by like available in SQL.

For sql we have the option to sort, for example:

You can use the WITH ORDER clause of the CREATE EXTERNAL TABLE if your data is already ordered

https://datafusion.apache.org/user-guide/sql/ddl.html#create-external-table

CREATE EXTERNAL TABLE test (
    c1  VARCHAR NOT NULL,
    c2  INT NOT NULL,
    c3  SMALLINT NOT NULL,
    c4  SMALLINT NOT NULL,
    c5  INT NOT NULL,
    c6  BIGINT NOT NULL,
    c7  SMALLINT NOT NULL,
    c8  INT NOT NULL,
    c9  BIGINT NOT NULL,
    c10 VARCHAR NOT NULL,
    c11 FLOAT NOT NULL,
    c12 DOUBLE NOT NULL,
    c13 VARCHAR NOT NULL
)
STORED AS CSV
-- this line tells DataFusion the data in the file is already ordered by (c2 ASC)
WITH ORDER (c2 ASC)
LOCATION '/path/to/aggregate_test_100.csv'
OPTIONS ('has_header' 'true');

But for writing my parquet or other format files, we don't support it.

Describe the solution you'd like

Add the sort support option for DataFrameWriteOptions

@zhuqi-lucas zhuqi-lucas added the enhancement New feature or request label Dec 21, 2024
@zhuqi-lucas
Copy link
Contributor Author

take

@zhuqi-lucas
Copy link
Contributor Author

cc @alamb @Dandandan

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant