You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by GitBox <gi...@apache.org> on 2022/05/04 23:24:00 UTC

[GitHub] [iceberg] rdblue commented on a diff in pull request #4693: Core - Add Parser for UpdateRequirement

rdblue commented on code in PR #4693:
URL: https://github.com/apache/iceberg/pull/4693#discussion_r865457512


##########
core/src/main/java/org/apache/iceberg/rest/requests/UpdateRequirementParser.java:
##########
@@ -0,0 +1,264 @@
+/*
+ * Licensed 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 com.fasterxml.jackson.core.JsonGenerator;
+import com.fasterxml.jackson.databind.JsonNode;
+import java.io.IOException;
+import java.io.StringWriter;
+import java.io.UncheckedIOException;
+import java.util.Locale;
+import java.util.Map;
+import org.apache.iceberg.relocated.com.google.common.base.Preconditions;
+import org.apache.iceberg.relocated.com.google.common.collect.ImmutableMap;
+import org.apache.iceberg.rest.requests.UpdateTableRequest.UpdateRequirement;
+import org.apache.iceberg.util.JsonUtil;
+
+public class UpdateRequirementParser {
+
+  private UpdateRequirementParser() {
+  }
+
+  private static final String TYPE = "type";
+
+  // assertion types
+  static final String ASSERT_TABLE_UUID = "assert-table-uuid";
+  static final String ASSERT_TABLE_DOES_NOT_EXIST = "assert-create";
+  static final String ASSERT_REF_SNAPSHOT_ID = "assert-ref-snapshot-id";
+  static final String ASSERT_LAST_ASSIGNED_FIELD_ID = "assert-last-assigned-field-id";
+  static final String ASSERT_CURRENT_SCHEMA_ID = "assert-current-schema-id";
+  static final String ASSERT_LAST_ASSIGNED_PARTITION_ID = "assert-last-assigned-partition-id";
+  static final String ASSERT_DEFAULT_SPEC_ID = "assert-default-spec-id";
+  static final String ASSERT_DEFAULT_SORT_ORDER_ID = "assert-default-write-order-id";
+
+  // AssertTableUUID
+  private static final String UUID = "uuid";
+
+  // AssertRefSnapshotID
+  // TODO - This is called `ref` in the spec.
+  //   https://github.com/apache/iceberg/blob/master/open-api/rest-catalog-open-api.yaml#L1359-L1360
+  private static final String NAME = "name";

Review Comment:
   How about `ref-name`?



-- 
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-unsubscribe@iceberg.apache.org

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


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