-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Don't use explicit Guice binding for config class #14039
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -26,6 +26,7 @@ | |
| import java.util.Optional; | ||
|
|
||
| import static io.airlift.configuration.ConditionalModule.conditionalModule; | ||
| import static io.airlift.configuration.ConfigBinder.configBinder; | ||
|
|
||
| public class HiveMetastoreModule | ||
| extends AbstractConfigurationAwareModule | ||
|
|
@@ -42,9 +43,8 @@ protected void setup(Binder binder) | |
| { | ||
| if (metastore.isPresent()) { | ||
| binder.bind(HiveMetastoreFactory.class).annotatedWith(RawHiveMetastoreFactory.class).toInstance(HiveMetastoreFactory.ofInstance(metastore.get())); | ||
| MetastoreTypeConfig metastoreTypeConfig = new MetastoreTypeConfig(); | ||
| metastoreTypeConfig.setMetastoreType("provided"); | ||
| binder.bind(MetastoreTypeConfig.class).toInstance(metastoreTypeConfig); | ||
| configBinder(binder).bindConfigDefaults(MetastoreTypeConfig.class, config -> config.setMetastoreType("provided")); | ||
| configBinder(binder).bindConfig(MetastoreTypeConfig.class); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is wrong. Here the code intention is not to expose any configurable properties
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I talked with @homar about this and was under the impression that this was done this way because there was no better way. I kinda understand why it's like this, but the current way is wrong too :)
I get that. But this code path is only used when |
||
| } | ||
| else { | ||
| bindMetastoreModule("thrift", new ThriftMetastoreModule()); | ||
|
|
||
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.
It was intentionally like this