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

fix: analyze/optimize plan in CREATE TABLE AS SELECT #6610

Merged
merged 1 commit into from
Jun 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions datafusion/core/src/execution/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -495,6 +495,7 @@ impl SessionContext {
}

let input = Arc::try_unwrap(input).unwrap_or_else(|e| e.as_ref().clone());
let input = self.state().optimize(&input)?;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is important 👍

I wonder if there is any test we can add to cover this case and prevent a regression?

Copy link
Member Author

@jackwener jackwener Jun 9, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have tried to add test to cover this case, but failed.
Because when I try to add test explain to show plan tree, but if sql is explain, df don't execute these code.
So I don't know how to cover it.

let table = self.table(&name).await;

match (if_not_exists, or_replace, table) {
Expand Down
2 changes: 1 addition & 1 deletion datafusion/core/tests/sqllogictests/test_files/groupby.slt
Original file line number Diff line number Diff line change
Expand Up @@ -2351,7 +2351,7 @@ GRC [80.0, 30.0] 110
TUR [100.0, 75.0] 175

# test_ordering_sensitive_aggregation7
# Lexicographical ordering requirement can be given as
# Lexicographical ordering requirement can be given as
# argument to the aggregate functions
query TT
EXPLAIN SELECT s.country, ARRAY_AGG(s.amount ORDER BY s.country DESC, s.amount DESC) AS amounts,
Expand Down