ravipesala commented on a change in pull request #3177: [CARBONDATA-3337][CARBONDATA-3306] Distributed index server
URL: https://github.com/apache/carbondata/pull/3177#discussion_r279641349 ########## File path: core/src/main/java/org/apache/carbondata/core/indexstore/blockletindex/BlockletDataMapFactory.java ########## @@ -315,33 +297,64 @@ public void clear(Segment segment) { public synchronized void clear() { if (segmentMap.size() > 0) { for (String segmentId : segmentMap.keySet().toArray(new String[segmentMap.size()])) { - clear(new Segment(segmentId, null, null)); + clear(segmentId); } } } - @Override - public List<CoarseGrainDataMap> getDataMaps(DataMapDistributable distributable) + @Override public List<String> getAllTableBlockletUniqueNames() { + List<String> indexFilePaths = new ArrayList<>(); + for (Map.Entry<String, Set<TableBlockIndexUniqueIdentifier>> entry : segmentMap.entrySet()) { + for (TableBlockIndexUniqueIdentifier tableBlockIndexUniqueIdentifier : entry.getValue()) { + indexFilePaths.add(tableBlockIndexUniqueIdentifier.getUniqueTableSegmentIdentifier()); + } + } + return indexFilePaths; + } + + @Override public List<CoarseGrainDataMap> getDataMaps(DataMapDistributable distributable) throws IOException { BlockletDataMapDistributable mapDistributable = (BlockletDataMapDistributable) distributable; List<TableBlockIndexUniqueIdentifierWrapper> identifiersWrapper = new ArrayList<>(); - Path indexPath = new Path(mapDistributable.getFilePath()); String segmentNo = mapDistributable.getSegment().getSegmentNo(); - if (indexPath.getName().endsWith(CarbonTablePath.INDEX_FILE_EXT)) { - String parent = indexPath.getParent().toString(); - identifiersWrapper.add(new TableBlockIndexUniqueIdentifierWrapper( - new TableBlockIndexUniqueIdentifier(parent, indexPath.getName(), null, segmentNo), - this.getCarbonTable())); - } else if (indexPath.getName().endsWith(CarbonTablePath.MERGE_INDEX_FILE_EXT)) { - SegmentIndexFileStore fileStore = new SegmentIndexFileStore(); - CarbonFile carbonFile = FileFactory.getCarbonFile(indexPath.toString()); - String parentPath = carbonFile.getParentFile().getAbsolutePath(); - List<String> indexFiles = fileStore.getIndexFilesFromMergeFile(carbonFile.getAbsolutePath()); + if (mapDistributable.getFilePath() == null) { Review comment: Better check for segment path and reuse the else condition code to read the index file ---------------------------------------------------------------- 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: [hidden email] With regards, Apache Git Services |
Free forum by Nabble | Edit this page |