Github user gvramana commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/2131#discussion_r178715161
--- Diff:
core/src/main/java/org/apache/carbondata/core/readcommitter/LatestFilesReadCommitted.java
---
@@ -0,0 +1,122 @@
+/*
+ * 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.File;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.carbondata.core.datamap.Segment;
+import org.apache.carbondata.core.datastore.filesystem.CarbonFile;
+import
org.apache.carbondata.core.indexstore.blockletindex.SegmentIndexFileStore;
+import org.apache.carbondata.core.statusmanager.LoadMetadataDetails;
+import org.apache.carbondata.core.statusmanager.SegmentStatus;
+import org.apache.carbondata.core.util.path.CarbonTablePath;
+
+public class LatestFilesReadCommitted implements ReadCommitted {
+
+ private String carbonFilePath;
+ private ReadCommittedIndexFileSnapShot readCommittedIndexFileSnapShot;
+
+ public LatestFilesReadCommitted(String path) {
+ this.carbonFilePath = path;
+ try {
+ takeCarbonIndexFileSnapShot();
+ } catch (IOException ex) {
+ // TODO Put proper Log and throw the exception out.
+ System.out.println("Error while reding index file");
+ }
+ }
+
+ @Override public LoadMetadataDetails[] getSegmentList() throws
IOException {
+ // Read the Segment path and form the LoadMetadataDetails array.
+ File fs = new File(carbonFilePath);
+
+ if (fs.isDirectory()) {
+
+ CarbonFile[] carbonIndexFiles =
SegmentIndexFileStore.getCarbonIndexFiles(carbonFilePath);
+ LoadMetadataDetails[] loadMetadataDetailsArray =
+ new LoadMetadataDetails[carbonIndexFiles.length];
+ int loadCount = 0;
+ for (int i = 0; i < carbonIndexFiles.length; i++) {
--- End diff --
There can be multiple indexfiles under same logical segment/transactionid
---