-
Notifications
You must be signed in to change notification settings - Fork 130
Propegate output_ordering to scan #4909
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -44,6 +44,7 @@ mod tests { | |
| use datafusion::prelude::SessionContext; | ||
| use datafusion_datasource::file_format::format_as_file_type; | ||
| use datafusion_expr::LogicalPlanBuilder; | ||
| use datafusion_physical_plan::display::DisplayableExecutionPlan; | ||
| use insta::assert_snapshot; | ||
| use rstest::rstest; | ||
| use tempfile::{TempDir, tempdir}; | ||
|
|
@@ -188,4 +189,80 @@ mod tests { | |
|
|
||
| Ok(()) | ||
| } | ||
|
|
||
| #[tokio::test] | ||
| async fn create_table_ordered_by() -> anyhow::Result<()> { | ||
| let dir = TempDir::new().unwrap(); | ||
|
|
||
| let factory: VortexFormatFactory = VortexFormatFactory::new(); | ||
| let mut session_state_builder = SessionStateBuilder::new().with_default_features(); | ||
| register_vortex_format_factory(factory, &mut session_state_builder); | ||
| let session = SessionContext::new_with_state(session_state_builder.build()); | ||
|
|
||
| // Vortex | ||
| session | ||
| .sql(&format!( | ||
| "CREATE EXTERNAL TABLE my_tbl_vx \ | ||
| (c1 VARCHAR NOT NULL, c2 INT NOT NULL) \ | ||
| STORED AS vortex \ | ||
| WITH ORDER (c1 ASC) | ||
| LOCATION '{}/vx/'", | ||
| dir.path().to_str().unwrap() | ||
| )) | ||
| .await?; | ||
|
|
||
| session | ||
| .sql("INSERT INTO my_tbl_vx VALUES ('air', 5), ('balloon', 42)") | ||
| .await? | ||
| .collect() | ||
| .await?; | ||
|
|
||
| session | ||
| .sql("INSERT INTO my_tbl_vx VALUES ('zebra', 5)") | ||
| .await? | ||
| .collect() | ||
| .await?; | ||
|
|
||
| session | ||
| .sql("INSERT INTO my_tbl_vx VALUES ('texas', 2000), ('alabama', 2000)") | ||
| .await? | ||
| .collect() | ||
| .await?; | ||
|
|
||
| let df = session | ||
| .sql("SELECT * FROM my_tbl_vx ORDER BY c1 ASC limit 3") | ||
| .await?; | ||
| let (state, plan) = df.clone().into_parts(); | ||
| let physical_plan = state.create_physical_plan(&plan).await?; | ||
|
|
||
| insta::assert_snapshot!(DisplayableExecutionPlan::new(physical_plan.as_ref()) | ||
| .tree_render().to_string(), @r" | ||
| ┌───────────────────────────┐ | ||
| │ SortPreservingMergeExec │ | ||
| │ -------------------- │ | ||
| │ c1 ASC NULLS LASTlimit: │ | ||
| │ 3 │ | ||
| └─────────────┬─────────────┘ | ||
| ┌─────────────┴─────────────┐ | ||
| │ DataSourceExec │ | ||
| │ -------------------- │ | ||
| │ files: 3 │ | ||
| │ format: vortex │ | ||
| └───────────────────────────┘ | ||
| "); | ||
|
Comment on lines
+240
to
+252
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. Shows plan is correct - it has no explicit |
||
|
|
||
| let r = df.collect().await?; | ||
|
|
||
| insta::assert_snapshot!(pretty_format_batches(&r)?.to_string(), @r" | ||
| +---------+------+ | ||
| | c1 | c2 | | ||
| +---------+------+ | ||
| | air | 5 | | ||
| | alabama | 2000 | | ||
| | balloon | 42 | | ||
| +---------+------+ | ||
| "); | ||
|
|
||
| Ok(()) | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
This makes
cargo test -p vortex-datafusionwork