/** * This method will create a table block info object from index file info * * @param readBlockIndexInfo * @param readIndexHeader * @param parentPath * @return */ public TableBlockInfo getTableBlockInfo(BlockIndex readBlockIndexInfo, org.apache.carbondata.format.IndexHeader readIndexHeader, String parentPath) { TableBlockInfo tableBlockInfo = new TableBlockInfo(); tableBlockInfo.setBlockOffset(readBlockIndexInfo.getOffset()); ColumnarFormatVersion version = ColumnarFormatVersion.valueOf((short) readIndexHeader.getVersion()); tableBlockInfo.setVersion(version); int blockletSize = getBlockletSize(readBlockIndexInfo); tableBlockInfo.getBlockletInfos().setNoOfBlockLets(blockletSize); String fileName = readBlockIndexInfo.file_name; // Take only name of file. if (fileName.lastIndexOf("/") > 0) { fileName = fileName.substring(fileName.lastIndexOf("/")); } fileName = (CarbonCommonConstants.FILE_SEPARATOR + fileName).replaceAll("//", "/"); tableBlockInfo.setFilePath(parentPath + fileName); return tableBlockInfo; }
tableBlockInfo.setVersion( ColumnarFormatVersion.valueOf((short) readIndexHeader.getVersion())); int blockletSize = getBlockletSize(readBlockIndexInfo); tableBlockInfo.getBlockletInfos().setNoOfBlockLets(blockletSize); dataFileFooter.setBlockletIndex(blockletIndex);