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

    https://github.com/apache/carbondata/pull/2131#discussion_r178739606
  
    --- Diff: 
core/src/main/java/org/apache/carbondata/core/indexstore/blockletindex/BlockletDataMapFactory.java
 ---
    @@ -83,28 +85,59 @@ public DataMapWriter createWriter(Segment segment, 
String writeDirectoryPath) {
       }
     
       @Override
    -  public List<CoarseGrainDataMap> getDataMaps(Segment segment) throws 
IOException {
    +  public List<CoarseGrainDataMap> getDataMaps(Segment segment, 
ReadCommitted readCommitted)
    +      throws IOException {
         List<TableBlockIndexUniqueIdentifier> tableBlockIndexUniqueIdentifiers 
=
    -        getTableBlockIndexUniqueIdentifiers(segment);
    +        getTableBlockIndexUniqueIdentifiers(segment, readCommitted);
         return cache.getAll(tableBlockIndexUniqueIdentifiers);
       }
     
    -  private List<TableBlockIndexUniqueIdentifier> 
getTableBlockIndexUniqueIdentifiers(
    -      Segment segment) throws IOException {
    +  private List<TableBlockIndexUniqueIdentifier> 
getTableBlockIndexUniqueIdentifiers(Segment segment,
    +      ReadCommitted readCommitted) throws IOException {
         List<TableBlockIndexUniqueIdentifier> tableBlockIndexUniqueIdentifiers 
=
             segmentMap.get(segment.getSegmentNo());
         if (tableBlockIndexUniqueIdentifiers == null) {
           tableBlockIndexUniqueIdentifiers = new ArrayList<>();
    +      // TODO: integrate with ReadCommitted
    +      //      ReadCommitted readCommitted;
    +      //      if 
(job.getConfiguration().get(CARBON_UNMANAGED_TABLE).equalsIgnoreCase("true")) {
    +      //        updateStatusManager = null;
    +      //        readCommitted = new 
LatestFilesReadCommitted(identifier.getTablePath());
    +      //      } else {
    +      //        loadMetadataDetails = SegmentStatusManager
    +      //         .readTableStatusFile(CarbonTablePath
    +      //          .getTableStatusFilePath(identifier.getTablePath()));
    +      //        updateStatusManager =
    +      //          new SegmentUpdateStatusManager(identifier, 
loadMetadataDetails);
    +      //        readCommitted =
    +      //          new TableStatusReadCommitted(job, this, 
loadMetadataDetails, updateStatusManager);
    +      //      }
    +      //            Map<String, String> indexFiles = 
readCommitted.getCommittedIndexList(segment);
           Map<String, String> indexFiles;
    -      if (segment.getSegmentFileName() == null) {
    -        String path =
    -            CarbonTablePath.getSegmentPath(identifier.getTablePath(), 
segment.getSegmentNo());
    -        indexFiles = new 
SegmentIndexFileStore().getIndexFilesFromSegment(path);
    +      if (CarbonUtil.isUnmanagedCarbonTable(identifier.getTablePath(), 
true)) {
    +        if (null != readCommitted) {
    +          indexFiles = readCommitted.getCommittedIndexMapSegments();
    +        } else {
    +          indexFiles =
    +              new 
SegmentIndexFileStore().getIndexFilesFromSegment(identifier.getTablePath());
    +        }
           } else {
    -        SegmentFileStore fileStore =
    -            new SegmentFileStore(identifier.getTablePath(), 
segment.getSegmentFileName());
    -        indexFiles = fileStore.getIndexFiles();
    +        if (segment.getSegmentFileName() == null) {
    +
    +          if (null != readCommitted) {
    +            indexFiles = 
readCommitted.getCommittedIndexMapPerSegment(segment);
    --- End diff --
    
    Done


---

Reply via email to