-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Core: Make PlanTableScanResponse buider withCredentials replace instead of append #17751
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 | ||||
|---|---|---|---|---|---|---|
|
|
@@ -25,7 +25,6 @@ | |||||
| import org.apache.iceberg.PartitionSpec; | ||||||
| import org.apache.iceberg.relocated.com.google.common.base.Preconditions; | ||||||
| import org.apache.iceberg.relocated.com.google.common.collect.ImmutableList; | ||||||
| import org.apache.iceberg.relocated.com.google.common.collect.Lists; | ||||||
| import org.apache.iceberg.rest.PlanStatus; | ||||||
| import org.apache.iceberg.rest.credentials.Credential; | ||||||
|
|
||||||
|
|
@@ -110,7 +109,7 @@ private Builder() {} | |||||
|
|
||||||
| private PlanStatus planStatus; | ||||||
| private ErrorResponse errorResponse; | ||||||
| private final List<Credential> credentials = Lists.newArrayList(); | ||||||
| private List<Credential> credentials = ImmutableList.of(); | ||||||
|
|
||||||
| public Builder withPlanStatus(PlanStatus status) { | ||||||
| this.planStatus = status; | ||||||
|
|
@@ -122,8 +121,10 @@ public Builder withErrorResponse(ErrorResponse response) { | |||||
| return this; | ||||||
| } | ||||||
|
|
||||||
| public Builder withCredentials(List<Credential> credentialsToAdd) { | ||||||
| credentials.addAll(credentialsToAdd); | ||||||
| public Builder withCredentials(List<Credential> newCredentials) { | ||||||
| Preconditions.checkArgument(null != newCredentials, "Invalid credentials: null"); | ||||||
| Preconditions.checkArgument(!newCredentials.contains(null), "Invalid credential: null"); | ||||||
|
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. do we actually need this check? We should get this for free when doing
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 think and I saw we have some precedence in iceberg/core/src/main/java/org/apache/iceberg/rest/responses/ListTablesResponse.java Line 84 in 7f879b1
iceberg/core/src/main/java/org/apache/iceberg/rest/responses/ListNamespacesResponse.java Line 83 in 7f879b1
|
||||||
| this.credentials = ImmutableList.copyOf(newCredentials); | ||||||
| return this; | ||||||
| } | ||||||
|
|
||||||
|
|
||||||
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.
per
iceberg/core/src/main/java/org/apache/iceberg/rest/responses/ListTablesResponse.java
Line 83 in 7f879b1
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 @singhpk234 , I think ListTableResponse is relative old (merged Feb 2022) compare to the latest agents.md guideline in
iceberg/AGENTS.md
Line 121 in f80a72f