-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Bugfix: Remove df-cli specific SQL statment options before executing with DataFusion #8426
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Conversation
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.
I like this approach -- thank you @devinjdangelo
) -> Result<AmazonS3Builder> { | ||
let bucket_name = get_bucket_name(url)?; | ||
let mut builder = AmazonS3Builder::from_env().with_bucket_name(bucket_name); | ||
|
||
if let (Some(access_key_id), Some(secret_access_key)) = ( | ||
cmd.options.get("access_key_id"), | ||
cmd.options.get("secret_access_key"), | ||
cmd.options.remove("access_key_id"), |
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 is a very subtle change -- maybe we can add a comment explaining why these options are removed
Likewise below
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.
Added some comments explaining why the keys are removed/plan made mutable within datafusion-cli.
I also updated one of the unit tests to invoke FileTypeWriterOptions::build to test for this issue in the future.
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.
Thank you
28469dd
to
0f71c99
Compare
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.
Looks great to me -- thank you @devinjdangelo
@@ -221,10 +221,12 @@ async fn exec_and_print( | |||
| LogicalPlan::Analyze(_) | |||
); | |||
|
|||
if let LogicalPlan::Ddl(DdlStatement::CreateExternalTable(cmd)) = &plan { | |||
// Note that cmd is a mutable reference so that create_external_table function can remove all |
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.
❤️
) -> Result<AmazonS3Builder> { | ||
let bucket_name = get_bucket_name(url)?; | ||
let mut builder = AmazonS3Builder::from_env().with_bucket_name(bucket_name); | ||
|
||
if let (Some(access_key_id), Some(secret_access_key)) = ( | ||
cmd.options.get("access_key_id"), | ||
cmd.options.get("secret_access_key"), | ||
cmd.options.remove("access_key_id"), |
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.
Thank you
…with DataFusion (apache#8426) * remove df-cli specific options from create external table options * add test and comments * cargo fmt * merge main * cargo toml format
Which issue does this PR close?
Closes #8421
Rationale for this change
See issue (PR in datafusion caused regression in datafusion-cli when using datafusion-cli specific SQL statement options)
What changes are included in this PR?
Any arbitrary SQL statement option parsed in datafusion-cli is removed if found before executing the plan.
Are these changes tested?
Yes, modified existing datafusion-cli unit test to make sure FileTypeWriterOptions::build will not throw an error when passing ObjectStore related datafusion-cli options.
Are there any user-facing changes?
No