/** * 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; }
for (TableBlockIndexUniqueIdentifier tableBlockIndexUniqueIdentifier : tableBlockIndexUniqueIdentifiers) { String indexFilePath = tableBlockIndexUniqueIdentifier.getIndexFilePath(); String fileName = tableBlockIndexUniqueIdentifier.getIndexFileName(); carbonIndexFiles[identifierCounter++] = FileFactory
/** * Below method will be used to load the segment of segments * One segment may have multiple task , so table segment will be loaded * based on task id and will return the map of taksId to table segment * map * * @return map of taks id to segment mapping * @throws IOException */ private BlockDataMap loadAndGetDataMap(TableBlockIndexUniqueIdentifier identifier, SegmentIndexFileStore indexFileStore, Map<String, BlockMetaInfo> blockMetaInfoMap, CarbonTable carbonTable, boolean addTableBlockToUnsafe, Configuration configuration) throws IOException, MemoryException { String uniqueTableSegmentIdentifier = identifier.getUniqueTableSegmentIdentifier(); Object lock = segmentLockMap.get(uniqueTableSegmentIdentifier); if (lock == null) { lock = addAndGetSegmentLock(uniqueTableSegmentIdentifier); } BlockDataMap dataMap; synchronized (lock) { dataMap = (BlockDataMap) BlockletDataMapFactory.createDataMap(carbonTable); dataMap.init(new BlockletDataMapModel(carbonTable, identifier.getIndexFilePath() + CarbonCommonConstants.FILE_SEPARATOR + identifier .getIndexFileName(), indexFileStore.getFileData(identifier.getIndexFileName()), blockMetaInfoMap, identifier.getSegmentId(), addTableBlockToUnsafe, configuration)); } return dataMap; }
new SegmentIndexFileStore(identifierWrapper.getConfiguration()); Set<String> filesRead = new HashSet<>(); String segmentFilePath = identifier.getIndexFilePath(); if (segInfoCache == null) { segInfoCache = new HashMap<String, Map<String, BlockMetaInfo>>();
&& indexFileStore.getFileData(identifier.getIndexFileName()) == null) { CarbonFile indexMergeFile = FileFactory.getCarbonFile( identifier.getIndexFilePath() + CarbonCommonConstants.FILE_SEPARATOR + identifier .getMergeIndexFileName(), identifierWrapper.getConfiguration()); if (indexMergeFile.exists() && !filesRead.contains(indexMergeFile.getPath())) { identifier.getIndexFilePath() + CarbonCommonConstants.FILE_SEPARATOR + identifier .getIndexFileName(), identifierWrapper.getConfiguration()) }); new DataFileFooterConverter(identifierWrapper.getConfiguration()); List<DataFileFooter> indexInfo = fileFooterConverter.getIndexInfo( identifier.getIndexFilePath() + CarbonCommonConstants.FILE_SEPARATOR + identifier .getIndexFileName(), indexFileStore.getFileData(identifier.getIndexFileName()), isTransactionalTable);