singhpk234 commented on code in PR #14562:
URL: https://github.com/apache/iceberg/pull/14562#discussion_r2515046339
##########
core/src/test/java/org/apache/iceberg/rest/responses/TestPlanTableScanResponseParser.java:
##########
@@ -65,6 +64,45 @@ public void roundTripSerdeWithEmptyObject() {
.hasMessage("Cannot parse planTableScan response from empty or null
object");
}
+ @Test
+ public void roundTripSerdeWithCompletedPlanningWithAndWithoutPlanId() {
+ PlanTableScanResponse response =
+ PlanTableScanResponse.builder()
+ .withPlanStatus(PlanStatus.COMPLETED)
+ .withSpecsById(PARTITION_SPECS_BY_ID)
+ .build();
+ assertThat(response.planStatus()).isEqualTo(PlanStatus.COMPLETED);
+ assertThat(response.planId()).isNull();
+ assertThat(PlanTableScanResponseParser.toJson(response))
+ .isEqualTo("{\"plan-status\":\"completed\"}");
+
+ response =
+ PlanTableScanResponse.builder()
+ .withPlanStatus(PlanStatus.COMPLETED)
+ .withPlanId("somePlanId")
+ .withSpecsById(PARTITION_SPECS_BY_ID)
+ .build();
+ assertThat(response.planStatus()).isEqualTo(PlanStatus.COMPLETED);
+ assertThat(response.planId()).isEqualTo("somePlanId");
+
+ assertThat(PlanTableScanResponseParser.toJson(response))
+
.isEqualTo("{\"plan-status\":\"completed\",\"plan-id\":\"somePlanId\"}");
+ }
+
+ @Test
+ public void roundTripSerdeWithSubmittedPlanningWithPlanId() {
+ PlanTableScanResponse response =
+ PlanTableScanResponse.builder()
+ .withPlanStatus(PlanStatus.SUBMITTED)
+ .withSpecsById(PARTITION_SPECS_BY_ID)
+ .withPlanId("somePlanId")
Review Comment:
plan-id is optional too for the submitted status :
https://github.com/apache/iceberg/blob/main/open-api/rest-catalog-open-api.yaml#L3409
it would be nice to have same coverage as we have for the compled too, side
note the only diff is status should we make it parameterized ?
--
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]