@Override public long getRetainedSize() { return super.getRetainedSize() + bufferedOutput.getRetainedSize(); }
@Override public CompressedSliceOutput get() { chunkedSliceOutput.reset(); return new CompressedSliceOutput(chunkedSliceOutput, chunkedSliceOutput, this, () -> {}); } }
public RcFileWriteValidation build() { return new RcFileWriteValidation(version, metadata, codecClassName, syncFirst, syncSecond, checksum.build()); } }
private void writeMetadataProperty(String key, String value) { writeLengthPrefixedString(output, utf8Slice(key)); writeLengthPrefixedString(output, utf8Slice(value)); recordValidation(validation -> validation.addMetadataProperty(key, value)); }
@Override public void writePage(Page page) throws IOException { writer.write(page); }
@Override public RcFileCompressor createCompressor(String codecName) { CompressionCodec codec = createCompressionCodec(codecName); return new HadoopCompressor(codec); }
private RcFileCorruptionException corrupt(String messageFormat, Object... args) { closeQuietly(); return new RcFileCorruptionException(messageFormat, args); }
@Override public RcFileDecompressor createDecompressor(String codecName) { CompressionCodec codec = createCompressionCodec(codecName); return new HadoopDecompressor(codec); }
@Override public void writeBytes(byte[] source) { writeBytes(source, 0, source.length); }
@Override public void close() throws IOException { // some hive input formats are broken and bad things can happen if you close them multiple times if (closed) { return; } closed = true; rcFileReader.close(); }
@Override public RcFileDataSourceId getId() { return new RcFileDataSourceId(path); }
@Override public int getValueLength(Slice slice, int offset) { return decodeVIntSize(slice, offset); }
@Override public SliceOutput appendBytes(byte[] source, int sourceIndex, int length) { writeBytes(source, sourceIndex, length); return this; }
@Override public SliceOutput appendLong(long value) { writeLong(value); return this; }
@Override public SliceOutput appendInt(int value) { writeInt(value); return this; }
@Override public SliceOutput appendShort(int value) { writeShort(value); return this; }
public RcFileWriteValidationBuilder addRowGroup(int rowCount) { checksum.addRowGroup(rowCount); return this; }
private void verify(boolean expression, String messageFormat, Object... args) throws RcFileCorruptionException { if (!expression) { throw corrupt(messageFormat, args); } }
@Override public long getSystemMemoryUsage() { return INSTANCE_SIZE + rcFileWriter.getRetainedSizeInBytes(); }
@Override public long getCompletedBytes() { return rcFileReader.getBytesRead(); }