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

Don't pick up S3 config file/env props automatically #763

Merged
merged 2 commits into from
Dec 16, 2024
Merged

Conversation

gruuya
Copy link
Contributor

@gruuya gruuya commented Dec 16, 2024

Do this by automatically setting the new S3_DISABLE_CONFIG_LOAD config var to true when any S3 options are passed in.

Also bump iceberg to pick up some type conversion/stats parsing fixes.

pub fn s3_opts_to_file_io_props(
key: AmazonS3ConfigKey,
val: &str,
props: &mut HashMap<String, String>,
Copy link
Collaborator

@lizardoluis lizardoluis Dec 16, 2024

Choose a reason for hiding this comment

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

You can declare this HashMap inside the function and just return it. It makes the signature and caller simpler.

And AFAIK, with rust, there is neither a copy nor a heap allocation involved when returning large structures

Copy link
Contributor Author

Choose a reason for hiding this comment

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

s3_opts_to_file_io_props processes a single key at a time, so I can't really return the entire map from it (i.e. it needs to "hydrate" an existing one).

Copy link
Collaborator

Choose a reason for hiding this comment

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

Ahh, ok. I didn't see the loop in the caller

props.insert(S3_ALLOW_ANONYMOUS.to_string(), val.clone());
props.insert(S3_DISABLE_EC2_METADATA.to_string(), val.clone());
continue;
match AmazonS3ConfigKey::from_str(key) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Lets move this function to lib.rs and delete this file.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Makes sense, done.

@gruuya gruuya merged commit 22ab168 into main Dec 16, 2024
2 checks passed
@gruuya gruuya deleted the bump-iceberg branch December 16, 2024 09:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants