vinothchandar commented on a change in pull request #1009:  [HUDI-308] Avoid 
Renames for tracking state transitions of all actions on dataset
URL: https://github.com/apache/incubator-hudi/pull/1009#discussion_r348020184
 
 

 ##########
 File path: 
hudi-common/src/main/java/org/apache/hudi/common/model/HoodieMetadataVersion.java
 ##########
 @@ -0,0 +1,77 @@
+/*
+ * 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.hudi.common.model;
+
+import com.google.common.base.Preconditions;
+import java.io.Serializable;
+import java.util.Objects;
+
+/**
+ * Metadata Layout Version. Add new version when timeline format changes
+ */
+public class HoodieMetadataVersion implements Serializable, 
Comparable<HoodieMetadataVersion> {
+
+  public static Integer VERSION_0 = 0; // pre 0.5.1  version format
+  public static Integer VERSION_1 = 1; // current version with no renames
+
+  public static Integer CURR_VERSION = VERSION_1;
+
+  private Integer version;
+
+  public HoodieMetadataVersion(Integer version) {
+    Preconditions.checkArgument(version <= CURR_VERSION);
+    Preconditions.checkArgument(version >= VERSION_0);
+    this.version = version;
+  }
+
+  /**
+   * For Pre 0.5.1 release, there was no metadata version. This method is used 
to detect
+   * this case.
+   * @return
+   */
+  public boolean isNullVersion() {
+    return Objects.equals(version, VERSION_0);
+  }
+
+  public Integer getVersion() {
+    return version;
+  }
+
+  @Override
+  public boolean equals(Object o) {
+    if (this == o) {
 
 Review comment:
   always wonder if this code needs to be written everytime? wont 
Objects.equals() handle this?

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to