public ColumnOutputBuffer(ColumnFileWriter writer, ColumnMetaData meta) throws IOException { this.writer = writer; this.meta = meta; this.codec = Codec.get(meta); this.checksum = Checksum.get(meta); this.buffer = new OutputBuffer(); this.blockDescriptors = new ArrayList<>(); this.blockData = new ArrayList<>(); if (meta.hasIndexValues()) this.firstValues = new ArrayList<>(); }
ColumnValues(ColumnDescriptor column) throws IOException { this.column = column; this.type = column.metaData.getType(); this.codec = Codec.get(column.metaData); this.checksum = Checksum.get(column.metaData); this.in = new InputBuffer(column.file); column.ensureBlocksRead(); }
public void ensureBlocksRead() throws IOException { if (blocks != null) return; // read block descriptors InputBuffer in = new InputBuffer(file, start); int blockCount = in.readFixed32(); BlockDescriptor[] blocks = new BlockDescriptor[blockCount]; if (metaData.hasIndexValues()) firstValues = (T[])new Comparable[blockCount]; for (int i = 0; i < blockCount; i++) { blocks[i] = BlockDescriptor.read(in); if (metaData.hasIndexValues()) firstValues[i] = in.readValue(metaData.getType()); } dataStart = in.tell(); // compute blockStarts and firstRows Checksum checksum = Checksum.get(metaData); blockStarts = new long[blocks.length]; firstRows = new long[blocks.length]; long startPosition = dataStart; long row = 0; for (int i = 0; i < blockCount; i++) { BlockDescriptor b = blocks[i]; blockStarts[i] = startPosition; firstRows[i] = row; startPosition += b.compressedSize + checksum.size(); row += b.rowCount; } this.blocks = blocks; }
public ColumnOutputBuffer(ColumnFileWriter writer, ColumnMetaData meta) throws IOException { this.writer = writer; this.meta = meta; this.codec = Codec.get(meta); this.checksum = Checksum.get(meta); this.buffer = new OutputBuffer(); this.blockDescriptors = new ArrayList<BlockDescriptor>(); this.blockData = new ArrayList<byte[]>(); if (meta.hasIndexValues()) this.firstValues = new ArrayList<byte[]>(); }
ColumnValues(ColumnDescriptor column) throws IOException { this.column = column; this.type = column.metaData.getType(); this.codec = Codec.get(column.metaData); this.checksum = Checksum.get(column.metaData); this.in = new InputBuffer(column.file); column.ensureBlocksRead(); }
public void ensureBlocksRead() throws IOException { if (blocks != null) return; // read block descriptors InputBuffer in = new InputBuffer(file, start); int blockCount = in.readFixed32(); BlockDescriptor[] blocks = new BlockDescriptor[blockCount]; if (metaData.hasIndexValues()) firstValues = (T[])new Comparable[blockCount]; for (int i = 0; i < blockCount; i++) { blocks[i] = BlockDescriptor.read(in); if (metaData.hasIndexValues()) firstValues[i] = in.<T>readValue(metaData.getType()); } dataStart = in.tell(); // compute blockStarts and firstRows Checksum checksum = Checksum.get(metaData); blockStarts = new long[blocks.length]; firstRows = new long[blocks.length]; long startPosition = dataStart; long row = 0; for (int i = 0; i < blockCount; i++) { BlockDescriptor b = blocks[i]; blockStarts[i] = startPosition; firstRows[i] = row; startPosition += b.compressedSize + checksum.size(); row += b.rowCount; } this.blocks = blocks; }