Github user ravipesala commented on a diff in the pull request:

    https://github.com/apache/carbondata/pull/2262#discussion_r186374044
  
    --- Diff: 
core/src/main/java/org/apache/carbondata/core/readcommitter/CommitedIndexFilesUpdatedTimestamp.java
 ---
    @@ -0,0 +1,73 @@
    +/*
    + * 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.carbondata.core.readcommitter;
    +
    +import java.io.Serializable;
    +import java.util.HashMap;
    +import java.util.Map;
    +
    +public class CommitedIndexFilesUpdatedTimestamp implements Serializable {
    +
    +  private Map<Long, Integer> updatedTimestampMap = new HashMap<>();
    +
    +  private static CommitedIndexFilesUpdatedTimestamp 
commitedIndexFilesUpdatedTimestamp =
    +      new CommitedIndexFilesUpdatedTimestamp();
    +
    +  public static CommitedIndexFilesUpdatedTimestamp getInstance() {
    +    return commitedIndexFilesUpdatedTimestamp;
    +  }
    +
    +  public Map<Long, Integer> getUpdatedTimestampMap() {
    +    return updatedTimestampMap;
    +  }
    +
    +  public void addUpdatedTimestampMap(Long timestampMap) {
    +    Integer c = updatedTimestampMap.get(timestampMap);
    +    if (c == null) {
    +      updatedTimestampMap.put(timestampMap, 1);
    +    } else {
    +      updatedTimestampMap.put(timestampMap, c + 1);
    +    }
    +  }
    +
    +  public void reset() {
    +    this.updatedTimestampMap = new HashMap<>();
    +  }
    +
    +  @Override public boolean equals(Object o) {
    +    if (this == o) return true;
    +    if (!(o instanceof CommitedIndexFilesUpdatedTimestamp)) return false;
    +
    +    CommitedIndexFilesUpdatedTimestamp that = 
(CommitedIndexFilesUpdatedTimestamp) o;
    +
    +    return updatedTimestampMap.equals(that.updatedTimestampMap);
    +  }
    +
    +  @Override public int hashCode() {
    +    return updatedTimestampMap.hashCode();
    +  }
    +
    +  public CommitedIndexFilesUpdatedTimestamp getClone() {
    --- End diff --
    
    It is not needed, create new object every time


---

Reply via email to