tschwarzinger commented on code in PR #27393: URL: https://github.com/apache/datafusion/pull/27393#discussion_r4560825753
########## datafusion/sqllogictest/test_files/aggregates_topk.slt: ########## Review Comment: Just as a not for me and others, the topk tests changed because now `topk.parquet` (and others) is no longer considered a sorted write in `DataSourceSink`. ########## datafusion/sqllogictest/test_files/copy.slt: ########## @@ -823,3 +823,46 @@ physical_plan statement count 0 drop table t; + +# COPY (... UNION ALL ... ORDER BY) must write rows in ORDER BY order when +# each UNION ALL arm selects a different literal and reads an already sorted +# input. The literal is constant within each arm but not across arms, so it +# must stay in the merge key. +# +# Earlier versions reported only [ts ASC NULLS LAST] as the merge key in SortPreservingMergeExec due to issues with the +# constants in the individual partitions. + +statement ok +COPY (SELECT * FROM (VALUES (1, 10.0), (2, 20.0), (3, 30.0)) AS v(ts, x) ORDER BY ts) Review Comment: Maybe we should add another slt test that verifies that `COPY (SELECT * FROM sorted_file) TO ...` (your example from the PR description) no longer has sorting guarantees and link to PostgreSQL / the standard? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
