amogh-jahagirdar commented on code in PR #11180:
URL: https://github.com/apache/iceberg/pull/11180#discussion_r1770662204


##########
core/src/main/java/org/apache/iceberg/rest/responses/FetchPlanningResultResponse.java:
##########
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.iceberg.rest.responses;
+
+import java.util.List;
+import javax.annotation.Nullable;
+import org.apache.iceberg.DeleteFile;
+import org.apache.iceberg.FileScanTask;
+import org.apache.iceberg.relocated.com.google.common.base.Preconditions;
+import org.apache.iceberg.rest.PlanStatus;
+import org.apache.iceberg.rest.RESTResponse;
+import org.immutables.value.Value;
+
+@Value.Immutable
+public interface FetchPlanningResultResponse extends RESTResponse {
+  PlanStatus planStatus();
+
+  @Nullable
+  List<String> planTasks();
+
+  @Nullable
+  List<FileScanTask> fileScanTasks();
+
+  @Nullable
+  List<DeleteFile> deleteFiles();

Review Comment:
   To be defensive against building invalid responses, I think we should 
validate that if delete files are not null then the file scan tasks are also 
not null.



##########
core/src/main/java/org/apache/iceberg/rest/responses/FetchScanTasksResponse.java:
##########
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.iceberg.rest.responses;
+
+import java.util.List;
+import javax.annotation.Nullable;
+import org.apache.iceberg.DeleteFile;
+import org.apache.iceberg.FileScanTask;
+import org.apache.iceberg.rest.RESTResponse;
+import org.immutables.value.Value;
+
+@Value.Immutable
+public interface FetchScanTasksResponse extends RESTResponse {
+
+  @Nullable
+  List<String> planTasks();
+
+  @Nullable
+  List<FileScanTask> fileScanTasks();
+
+  @Nullable
+  List<DeleteFile> deleteFiles();
+
+  @Override
+  default void validate() {}

Review Comment:
   For `FetchScanTasksResponse` don't we need validation that one of planTasks 
or fileScanTasks must be defined? 



##########
core/src/main/java/org/apache/iceberg/rest/requests/PlanTableScanRequest.java:
##########
@@ -0,0 +1,67 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.iceberg.rest.requests;
+
+import java.util.List;
+import javax.annotation.Nullable;
+import org.apache.iceberg.expressions.Expression;
+import org.apache.iceberg.relocated.com.google.common.base.Preconditions;
+import org.apache.iceberg.rest.RESTRequest;
+import org.immutables.value.Value;
+
+@Value.Immutable
+public interface PlanTableScanRequest extends RESTRequest {
+
+  @Nullable
+  Long snapshotId();
+
+  @Nullable
+  List<String> select();
+
+  @Nullable
+  Expression filter();
+
+  @Nullable
+  @Value.Default
+  default Boolean caseSensitive() {
+    return true;
+  }
+
+  @Nullable
+  @Value.Default
+  default Boolean useSnapShotSchema() {
+    return false;
+  }
+
+  @Nullable
+  Long startSnapShotId();
+
+  @Nullable
+  Long endSnapShotId();

Review Comment:
   `endSnapshotId()`



##########
core/src/main/java/org/apache/iceberg/rest/responses/PlanTableScanResponse.java:
##########
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.iceberg.rest.responses;
+
+import java.util.List;
+import javax.annotation.Nullable;
+import org.apache.iceberg.DeleteFile;
+import org.apache.iceberg.FileScanTask;
+import org.apache.iceberg.relocated.com.google.common.base.Preconditions;
+import org.apache.iceberg.rest.PlanStatus;
+import org.apache.iceberg.rest.RESTResponse;
+
+public interface PlanTableScanResponse extends RESTResponse {
+  PlanStatus planStatus();
+
+  @Nullable
+  String planId();
+
+  @Nullable
+  List<String> planTasks();
+
+  @Nullable
+  List<FileScanTask> fileScanTasks();
+
+  @Nullable
+  List<DeleteFile> deleteFiles();
+
+  @Override
+  default void validate() {
+    Preconditions.checkArgument(planStatus() != null, "invalid response, 
status can not be null");

Review Comment:
   I think there needs to be validation that when the planStatus is Submitted 
there's a planId() 
https://github.com/apache/iceberg/blame/main/open-api/rest-catalog-open-api.yaml#L624



##########
core/src/main/java/org/apache/iceberg/rest/responses/FetchScanTasksResponse.java:
##########
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.iceberg.rest.responses;
+
+import java.util.List;
+import javax.annotation.Nullable;
+import org.apache.iceberg.DeleteFile;
+import org.apache.iceberg.FileScanTask;
+import org.apache.iceberg.rest.RESTResponse;
+import org.immutables.value.Value;
+
+@Value.Immutable
+public interface FetchScanTasksResponse extends RESTResponse {
+
+  @Nullable
+  List<String> planTasks();
+
+  @Nullable
+  List<FileScanTask> fileScanTasks();
+
+  @Nullable
+  List<DeleteFile> deleteFiles();
+
+  @Override
+  default void validate() {}

Review Comment:
   and I think the same delete file comment from above applies



##########
core/src/main/java/org/apache/iceberg/rest/requests/FetchScanTasksRequest.java:
##########
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.iceberg.rest.requests;
+
+import org.apache.iceberg.relocated.com.google.common.base.Preconditions;
+import org.apache.iceberg.rest.RESTRequest;
+import org.immutables.value.Value;
+
+@Value.Immutable
+public interface FetchScanTasksRequest extends RESTRequest {
+
+  String planTask();
+
+  @Override
+  default void validate() {
+    Preconditions.checkArgument(
+        planTask() != null, "invalid request, requires planTask to be 
provided");
+  }

Review Comment:
   Do we need this? I think if it's not marked as nullable, immutables will 
prevent building it.



##########
core/src/main/java/org/apache/iceberg/rest/requests/PlanTableScanRequest.java:
##########
@@ -0,0 +1,67 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.iceberg.rest.requests;
+
+import java.util.List;
+import javax.annotation.Nullable;
+import org.apache.iceberg.expressions.Expression;
+import org.apache.iceberg.relocated.com.google.common.base.Preconditions;
+import org.apache.iceberg.rest.RESTRequest;
+import org.immutables.value.Value;
+
+@Value.Immutable
+public interface PlanTableScanRequest extends RESTRequest {
+
+  @Nullable
+  Long snapshotId();
+
+  @Nullable
+  List<String> select();
+
+  @Nullable
+  Expression filter();
+
+  @Nullable
+  @Value.Default
+  default Boolean caseSensitive() {
+    return true;
+  }
+
+  @Nullable
+  @Value.Default
+  default Boolean useSnapShotSchema() {
+    return false;
+  }
+
+  @Nullable
+  Long startSnapShotId();

Review Comment:
   `startSnapshotId()`



-- 
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: issues-unsubscr...@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org
For additional commands, e-mail: issues-h...@iceberg.apache.org

Reply via email to