-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Core: Fix API breakage introduced by #13191 #13386
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 |
|---|---|---|
|
|
@@ -149,10 +149,16 @@ protected abstract <T extends RESTResponse> T execute( | |
| Consumer<ErrorResponse> errorHandler, | ||
| Consumer<Map<String, String>> responseHeaders); | ||
|
|
||
| protected abstract <T extends RESTResponse> T execute( | ||
| protected <T extends RESTResponse> T execute( | ||
| HTTPRequest request, | ||
| Class<T> responseType, | ||
| Consumer<ErrorResponse> errorHandler, | ||
| Consumer<Map<String, String>> responseHeaders, | ||
| ParserContext parserContext); | ||
| ParserContext parserContext) { | ||
| if (null != parserContext) { | ||
| throw new UnsupportedOperationException("Parser context is not supported"); | ||
| } | ||
|
|
||
| return execute(request, responseType, errorHandler, responseHeaders); | ||
|
Comment on lines
+158
to
+162
Contributor
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. Nice, this is a more elegant way to completely avoid the API breakage.
Contributor
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. isn't the execute without parserContext still abstract ? except the parser context being package protected ?
Contributor
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. is the intention to just have one abstract method for execute ? I agree with the ParserContext being made public
Contributor
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.
@singhpk234 I think it's more in general that when there's an opportunity to avoid public classes being forced to implement something on upgrade we should try do it that way since we can establish an opinionated default implementation; it's not always possible but here I think it is. So specifically prior to this change client implementations were already forced to implement
Contributor
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. That make sense ! thank you for the explanation @amogh-jahagirdar ! |
||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -22,8 +22,9 @@ | |
| import java.util.Collections; | ||
| import java.util.Map; | ||
| import org.apache.hadoop.util.Preconditions; | ||
| import org.apache.iceberg.relocated.com.google.common.collect.Maps; | ||
|
|
||
| class ParserContext { | ||
| public class ParserContext { | ||
|
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. the class is being used in public API methods, therefore it should be public
Contributor
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. Yeah technically anyone can use the packaged HttpClient independently make a request on their own and pass through their own |
||
|
|
||
| private final Map<String, Object> data; | ||
|
|
||
|
|
@@ -44,11 +45,7 @@ static Builder builder() { | |
| } | ||
|
|
||
| static class Builder { | ||
| private Map<String, Object> data; | ||
|
|
||
| private Builder() { | ||
| this.data = Collections.emptyMap(); | ||
| } | ||
| private final Map<String, Object> data = Maps.newHashMap(); | ||
|
|
||
| public Builder add(String key, Object value) { | ||
| Preconditions.checkNotNull(key, "Key cannot be null"); | ||
|
|
||
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.
Will this actually stop a user from being broken on upgrade? If you extend this class and execute is called without the parserContext it still breaks but now you don't know that until runtime?
I may misunderstand the full range of possibilities here, but isn't the internal Iceberg SDK passing through the ParserContext here?