示例#1
0
 private BlockMetaData newBlock(long start, long compressedBlockSize) {
   BlockMetaData blockMetaData = new BlockMetaData();
   long uncompressedSize = compressedBlockSize * 2; // assuming the compression ratio is 2
   ColumnChunkMetaData column =
       ColumnChunkMetaData.get(
           ColumnPath.get("foo"),
           PrimitiveTypeName.BINARY,
           CompressionCodecName.GZIP,
           new HashSet<Encoding>(Arrays.asList(Encoding.PLAIN)),
           new BinaryStatistics(),
           start,
           0l,
           0l,
           compressedBlockSize,
           uncompressedSize);
   blockMetaData.addColumn(column);
   blockMetaData.setTotalByteSize(uncompressedSize);
   return blockMetaData;
 }
示例#2
0
  public static BlockMetaData makeBlockFromStats(IntStatistics stats, long valueCount) {
    BlockMetaData blockMetaData = new BlockMetaData();

    ColumnChunkMetaData column =
        ColumnChunkMetaData.get(
            ColumnPath.get("foo"),
            PrimitiveTypeName.INT32,
            CompressionCodecName.GZIP,
            new HashSet<Encoding>(Arrays.asList(Encoding.PLAIN)),
            stats,
            100l,
            100l,
            valueCount,
            100l,
            100l);
    blockMetaData.addColumn(column);
    blockMetaData.setTotalByteSize(200l);
    blockMetaData.setRowCount(valueCount);
    return blockMetaData;
  }
 /**
  * end a column (once all rep, def and data have been written)
  *
  * @throws IOException
  */
 public void endColumn() throws IOException {
   state = state.endColumn();
   if (DEBUG) LOG.debug(out.getPos() + ": end column");
   currentBlock.addColumn(
       ColumnChunkMetaData.get(
           currentChunkPath,
           currentChunkType,
           currentChunkCodec,
           currentEncodings,
           currentStatistics,
           currentChunkFirstDataPage,
           currentChunkDictionaryPageOffset,
           currentChunkValueCount,
           compressedLength,
           uncompressedLength));
   if (DEBUG) LOG.info("ended Column chumk: " + currentColumn);
   currentColumn = null;
   this.currentBlock.setTotalByteSize(currentBlock.getTotalByteSize() + uncompressedLength);
   this.uncompressedLength = 0;
   this.compressedLength = 0;
 }