Skip to content

Conversation

@jonathanc-n
Copy link
Contributor

Which issue does this PR close?

What changes are included in this PR?

Makes CatalogConfig calls more explicit.

Are these changes tested?

Copy link
Contributor Author

@jonathanc-n jonathanc-n left a 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

Copy link
Contributor

@liurenjie1024 liurenjie1024 left a 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.


impl GlueCatalogBuilder {
/// Get a mutable reference to the catalog configuration.
pub(crate) fn catalog_config(&mut self) -> &mut GlueCatalogConfig {
Copy link
Contributor

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.

Copy link
Contributor Author

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)]
Copy link
Contributor

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?

Copy link
Contributor Author

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?

Copy link
Contributor

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?

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.

minor: Make CatalogBuilder.0 more explicit

2 participants