-
Notifications
You must be signed in to change notification settings - Fork 358
chore: Improve clarity when using CatalogConfigs in CatalogBuilder
#1873
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
base: main
Are you sure you want to change the base?
chore: Improve clarity when using CatalogConfigs in CatalogBuilder
#1873
Conversation
jonathanc-n
left a comment
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.
Just some comments to clarify to reviewers
liurenjie1024
left a comment
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.
Thanks @jonathanc-n for this pr, I have some suggestions to improve the readability.
crates/catalog/glue/src/catalog.rs
Outdated
|
|
||
| impl GlueCatalogBuilder { | ||
| /// Get a mutable reference to the catalog configuration. | ||
| pub(crate) fn catalog_config(&mut self) -> &mut GlueCatalogConfig { |
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'm not a big fan of such a change. I think a better approach would be following:
pub struct GlueCatalogBuilder {
name: Option<String>,
....
}
struct GlueCatalogConfig {
name: String
}This makes things easier to read, more importantly, the config class type safe. Builder struct need to store intermediate states, so it's reasonable to have it contains many optional fields. The config struct, which is finally built and verfied, should only contain valid states, e.g. it should no longer has unnecessary optional fields.
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.
Made the changes in 400c6b6
| } | ||
|
|
||
| /// Rest catalog configuration. | ||
| #[derive(Clone, Debug, TypedBuilder)] |
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.
Do we still need this TypedBuilder?
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.
Just some questions for this one. Would this be breaking? Should I change the builder functionality for RestCatalog to be similar to the other catalogs (ex. using the load function.? Do you know why the builder for this one is different from the other catalogs?
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 think it will not breaking since it's not public api. Is there any place actually using the generated builder of RestCatalogConfig?
Which issue does this PR close?
CatalogBuilder.0more explicit #1862 .What changes are included in this PR?
Makes
CatalogConfigcalls more explicit.Are these changes tested?