singhpk234 commented on code in PR #16449:
URL: https://github.com/apache/iceberg/pull/16449#discussion_r3692446380
##########
core/src/main/java/org/apache/iceberg/rest/responses/BaseScanTaskResponse.java:
##########
@@ -85,28 +81,15 @@ public B withPlanTasks(List<String> tasks) {
public B withFileScanTasks(List<FileScanTask> tasks) {
this.fileScanTasks = tasks;
- if (fileScanTasks != null) {
- this.deleteFiles =
- DeleteFileSet.of(
- () -> tasks.stream().flatMap(task ->
task.deletes().stream()).iterator());
- }
+ this.deleteFiles =
+ tasks == null
+ ? null
+ : DeleteFileSet.of(
+ () -> tasks.stream().flatMap(task ->
task.deletes().stream()).iterator());
Review Comment:
is this required ?
##########
core/src/main/java/org/apache/iceberg/rest/responses/FetchPlanningResultResponse.java:
##########
@@ -65,6 +65,29 @@ public static Builder builder() {
return new Builder();
}
+ /**
+ * Returns a new builder pre-populated with the given partition specs map.
Required for server
+ * responses that serialize {@code fileScanTasks} or {@code deleteFiles};
the specs are used only
+ * to serialize partition data and are never written to the response payload.
+ */
+ public static Builder builder(Map<Integer, PartitionSpec> specsById) {
+ return new Builder().withSpecsById(specsById);
+ }
+
+ /**
+ * Returns a builder pre-populated with this response's fields, suitable for
producing a copy with
+ * one or more fields modified.
+ */
+ public Builder toBuilder() {
+ return new Builder()
+ .withPlanStatus(planStatus)
+ .withErrorResponse(errorResponse)
+ .withPlanTasks(planTasks())
+ .withFileScanTasks(fileScanTasks())
+ .withCredentials(credentials())
+ .withSpecsById(specsById());
+ }
Review Comment:
is this required ?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]