use of org.apache.carbondata.format.SegmentInfo in project carbondata by apache.
the class CarbonMetadataUtil method getFileFooter.
/**
* Below method will be used to get the file footer object
*
* @param infoList blocklet info
* @param cardinalities cardinlaity of dimension columns
* @param columnSchemaList column schema list
* @return file footer
*/
private static FileFooter getFileFooter(List<BlockletInfoColumnar> infoList, int[] cardinalities, List<ColumnSchema> columnSchemaList) {
SegmentInfo segmentInfo = new SegmentInfo();
segmentInfo.setNum_cols(columnSchemaList.size());
segmentInfo.setColumn_cardinalities(CarbonUtil.convertToIntegerList(cardinalities));
ColumnarFormatVersion version = CarbonProperties.getInstance().getFormatVersion();
FileFooter footer = new FileFooter();
footer.setVersion(version.number());
footer.setNum_rows(getTotalNumberOfRows(infoList));
footer.setSegment_info(segmentInfo);
footer.setTable_columns(columnSchemaList);
for (BlockletInfoColumnar info : infoList) {
footer.addToBlocklet_index_list(getBlockletIndex(info));
}
return footer;
}
use of org.apache.carbondata.format.SegmentInfo in project carbondata by apache.
the class CarbonMetadataUtil method getIndexHeader.
/**
* Below method will be used to get the index header
*
* @param columnCardinality cardinality of each column
* @param columnSchemaList list of column present in the table
* @return Index header object
*/
public static IndexHeader getIndexHeader(int[] columnCardinality, List<ColumnSchema> columnSchemaList, int bucketNumber) {
// create segment info object
SegmentInfo segmentInfo = new SegmentInfo();
// set the number of columns
segmentInfo.setNum_cols(columnSchemaList.size());
// setting the column cardinality
segmentInfo.setColumn_cardinalities(CarbonUtil.convertToIntegerList(columnCardinality));
// create index header object
IndexHeader indexHeader = new IndexHeader();
ColumnarFormatVersion version = CarbonProperties.getInstance().getFormatVersion();
indexHeader.setVersion(version.number());
// set the segment info
indexHeader.setSegment_info(segmentInfo);
// set the column names
indexHeader.setTable_columns(columnSchemaList);
// set the bucket number
indexHeader.setBucket_id(bucketNumber);
return indexHeader;
}
use of org.apache.carbondata.format.SegmentInfo in project carbondata by apache.
the class CarbonMetadataUtil method getFileFooter3.
/**
* Below method will be used to get the file footer object
*
* @param infoList blocklet info
* @param blockletIndexs
* @param cardinalities cardinlaity of dimension columns
* @param numberOfColumns
* @return file footer
*/
private static FileFooter3 getFileFooter3(List<BlockletInfo3> infoList, List<BlockletIndex> blockletIndexs, int[] cardinalities, int numberOfColumns) {
SegmentInfo segmentInfo = new SegmentInfo();
segmentInfo.setNum_cols(numberOfColumns);
segmentInfo.setColumn_cardinalities(CarbonUtil.convertToIntegerList(cardinalities));
FileFooter3 footer = new FileFooter3();
footer.setNum_rows(getNumberOfRowForFooter(infoList));
footer.setSegment_info(segmentInfo);
for (BlockletIndex info : blockletIndexs) {
footer.addToBlocklet_index_list(info);
}
return footer;
}
Aggregations