-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Support InsertInto Sorted ListingTable #7743
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -223,6 +223,7 @@ impl TableProvider for MemTable { | |
| input, | ||
| sink, | ||
| self.schema.clone(), | ||
| None, | ||
| ))) | ||
| } | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -604,7 +604,7 @@ impl DefaultPhysicalPlanner { | |
| FileType::ARROW => Arc::new(ArrowFormat {}), | ||
| }; | ||
|
|
||
| sink_format.create_writer_physical_plan(input_exec, session_state, config).await | ||
| sink_format.create_writer_physical_plan(input_exec, session_state, config, None).await | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
| } | ||
| LogicalPlan::Dml(DmlStatement { | ||
| table_name, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -45,6 +45,48 @@ LOCATION '../../testing/data/csv/aggregate_test_100.csv' | |
| statement ok | ||
| set datafusion.execution.target_partitions = 8; | ||
|
|
||
| statement ok | ||
| CREATE EXTERNAL TABLE | ||
| ordered_insert_test(a bigint, b bigint) | ||
| STORED AS csv | ||
| LOCATION 'test_files/scratch/insert_to_external/insert_to_ordered/' | ||
| WITH ORDER (a ASC, B DESC) | ||
| OPTIONS( | ||
| create_local_path 'true', | ||
| insert_mode 'append_new_files', | ||
| ); | ||
|
|
||
| query TT | ||
| EXPLAIN INSERT INTO ordered_insert_test values (5, 1), (4, 2), (7,7), (7,8), (7,9), (7,10), (3, 3), (2, 4), (1, 5); | ||
| ---- | ||
| logical_plan | ||
| Dml: op=[Insert Into] table=[ordered_insert_test] | ||
| --Projection: column1 AS a, column2 AS b | ||
| ----Values: (Int64(5), Int64(1)), (Int64(4), Int64(2)), (Int64(7), Int64(7)), (Int64(7), Int64(8)), (Int64(7), Int64(9))... | ||
| physical_plan | ||
| InsertExec: sink=CsvSink(writer_mode=PutMultipart, file_groups=[]) | ||
| --SortExec: expr=[a@0 ASC NULLS LAST,b@1 DESC] | ||
| ----ProjectionExec: expr=[column1@0 as a, column2@1 as b] | ||
| ------ValuesExec | ||
|
|
||
| query II | ||
| INSERT INTO ordered_insert_test values (5, 1), (4, 2), (7,7), (7,8), (7,9), (7,10), (3, 3), (2, 4), (1, 5); | ||
| ---- | ||
| 9 | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you please also add an
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just pushed an update with explain test. |
||
|
|
||
| query II | ||
| SELECT * from ordered_insert_test; | ||
| ---- | ||
| 1 5 | ||
| 2 4 | ||
| 3 3 | ||
| 4 2 | ||
| 5 1 | ||
| 7 10 | ||
| 7 9 | ||
| 7 8 | ||
| 7 7 | ||
|
|
||
| statement ok | ||
| CREATE EXTERNAL TABLE | ||
| single_file_test(a bigint, b bigint) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍