public static Set<TableBlockIndexUniqueIdentifier> getTableBlockUniqueIdentifiers(Segment segment) throws IOException { Set<TableBlockIndexUniqueIdentifier> tableBlockIndexUniqueIdentifiers = new HashSet<>(); Map<String, String> indexFiles = segment.getCommittedIndexFile(); for (Map.Entry<String, String> indexFileEntry : indexFiles.entrySet()) { Path indexFile = new Path(indexFileEntry.getKey()); tableBlockIndexUniqueIdentifiers.add( new TableBlockIndexUniqueIdentifier(indexFile.getParent().toString(), indexFile.getName(), indexFileEntry.getValue(), segment.getSegmentNo())); } return tableBlockIndexUniqueIdentifiers; }
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)) { for (String indexFile : indexFiles) { identifiersWrapper.add(new TableBlockIndexUniqueIdentifierWrapper( new TableBlockIndexUniqueIdentifier(parentPath, indexFile, carbonFile.getName(), segmentNo), this.getCarbonTable()));
/** * This method will the index files tableBlockIndexUniqueIdentifiers of a merge index file * * @param identifier * @param segmentIndexFileStore * @return * @throws IOException */ public static List<TableBlockIndexUniqueIdentifier> getIndexFileIdentifiersFromMergeFile( TableBlockIndexUniqueIdentifier identifier, SegmentIndexFileStore segmentIndexFileStore) throws IOException { List<TableBlockIndexUniqueIdentifier> tableBlockIndexUniqueIdentifiers = new ArrayList<>(); String mergeFilePath = identifier.getIndexFilePath() + CarbonCommonConstants.FILE_SEPARATOR + identifier .getIndexFileName(); segmentIndexFileStore.readMergeFile(mergeFilePath); List<String> indexFiles = segmentIndexFileStore.getCarbonMergeFileToIndexFilesMap().get(mergeFilePath); for (String indexFile : indexFiles) { tableBlockIndexUniqueIdentifiers.add( new TableBlockIndexUniqueIdentifier(identifier.getIndexFilePath(), indexFile, identifier.getIndexFileName(), identifier.getSegmentId())); } return tableBlockIndexUniqueIdentifiers; }