use of org.apache.carbondata.core.reader.CarbonFooterReader in project carbondata by apache.
the class DataFileFooterConverter method getSchema.
@Override
public List<ColumnSchema> getSchema(TableBlockInfo tableBlockInfo) throws IOException {
FileReader fileReader = null;
List<ColumnSchema> columnSchemaList = new ArrayList<ColumnSchema>();
try {
long completeBlockLength = tableBlockInfo.getBlockLength();
long footerPointer = completeBlockLength - 8;
fileReader = FileFactory.getFileHolder(FileFactory.getFileType(tableBlockInfo.getFilePath()));
long actualFooterOffset = fileReader.readLong(tableBlockInfo.getFilePath(), footerPointer);
CarbonFooterReader reader = new CarbonFooterReader(tableBlockInfo.getFilePath(), actualFooterOffset);
FileFooter footer = reader.readFooter();
List<org.apache.carbondata.format.ColumnSchema> table_columns = footer.getTable_columns();
for (int i = 0; i < table_columns.size(); i++) {
columnSchemaList.add(thriftColumnSchmeaToWrapperColumnSchema(table_columns.get(i)));
}
} finally {
if (null != fileReader) {
fileReader.finish();
}
}
return columnSchemaList;
}
Aggregations