use of org.apache.carbondata.format.FileFooter in project carbondata by apache.
the class CarbonFactDataWriterImplV1 method writeBlockletInfoToFile.
/**
* This method will write metadata at the end of file file format in thrift format
*/
protected void writeBlockletInfoToFile(FileChannel channel, String filePath) throws CarbonDataWriterException {
try {
long currentPosition = channel.size();
CarbonFooterWriter writer = new CarbonFooterWriter(filePath);
FileFooter convertFileMeta = CarbonMetadataUtil.convertFileFooter(blockletInfoList, localCardinality.length, localCardinality, thriftColumnSchemaList, dataWriterVo.getSegmentProperties());
fillBlockIndexInfoDetails(convertFileMeta.getNum_rows(), carbonDataFileName, currentPosition);
writer.writeFooter(convertFileMeta, currentPosition);
} catch (IOException e) {
throw new CarbonDataWriterException("Problem while writing the carbon file: ", e);
}
}
use of org.apache.carbondata.format.FileFooter in project carbondata by apache.
the class CarbonFooterReader method readFooter.
/**
* It reads the metadata in FileFooter thrift object format.
*
* @return
* @throws IOException
*/
public FileFooter readFooter() throws IOException {
ThriftReader thriftReader = openThriftReader(filePath);
thriftReader.open();
//Set the offset from where it should read
thriftReader.setReadOffset(offset);
FileFooter footer = (FileFooter) thriftReader.read();
thriftReader.close();
return footer;
}
Aggregations