Search in sources :

Example 1 with SegmentInfo

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;
}
Also used : BlockletInfoColumnar(org.apache.carbondata.core.metadata.BlockletInfoColumnar) SegmentInfo(org.apache.carbondata.format.SegmentInfo) FileFooter(org.apache.carbondata.format.FileFooter) ColumnarFormatVersion(org.apache.carbondata.core.metadata.ColumnarFormatVersion)

Example 2 with SegmentInfo

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;
}
Also used : IndexHeader(org.apache.carbondata.format.IndexHeader) SegmentInfo(org.apache.carbondata.format.SegmentInfo) ColumnarFormatVersion(org.apache.carbondata.core.metadata.ColumnarFormatVersion)

Example 3 with SegmentInfo

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;
}
Also used : FileFooter3(org.apache.carbondata.format.FileFooter3) BlockletIndex(org.apache.carbondata.format.BlockletIndex) SegmentInfo(org.apache.carbondata.format.SegmentInfo)

Aggregations

SegmentInfo (org.apache.carbondata.format.SegmentInfo)3 ColumnarFormatVersion (org.apache.carbondata.core.metadata.ColumnarFormatVersion)2 BlockletInfoColumnar (org.apache.carbondata.core.metadata.BlockletInfoColumnar)1 BlockletIndex (org.apache.carbondata.format.BlockletIndex)1 FileFooter (org.apache.carbondata.format.FileFooter)1 FileFooter3 (org.apache.carbondata.format.FileFooter3)1 IndexHeader (org.apache.carbondata.format.IndexHeader)1