fixedBits = LongDecode.decodeBitWidth(fixedBits); long firstVal = LongDecode.readVInt(signed, input); long fixedDelta = LongDecode.readSignedVInt(input); long deltaBase = LongDecode.readSignedVInt(input);
@Override public long next() throws IOException { return readDwrfLong(input, orcTypeKind, signed, usesVInt); } }
public static long readVInt(boolean signed, OrcInputStream inputStream) throws IOException { if (signed) { return readSignedVInt(inputStream); } else { return readUnsignedVInt(inputStream); } }
public static long readSignedVInt(OrcInputStream inputStream) throws IOException { long result = readUnsignedVInt(inputStream); return zigzagDecode(result); }
public static void writeVLong(SliceOutput buffer, long value, boolean signed) { if (signed) { value = zigzagEncode(value); } writeVLongUnsigned(buffer, value); }
private void readValues() throws IOException { lastReadInputCheckpoint = input.getCheckpoint(); int control = input.read(); if (control == -1) { throw new OrcCorruptionException(input.getOrcDataSourceId(), "Read past end of RLE integer"); } if (control < 0x80) { numLiterals = control + MIN_REPEAT_SIZE; used = 0; repeat = true; delta = input.read(); if (delta == -1) { throw new OrcCorruptionException(input.getOrcDataSourceId(), "End of stream in RLE Integer"); } // convert from 0 to 255 to -128 to 127 by converting to a signed byte // noinspection SillyAssignment delta = (byte) delta; literals[0] = LongDecode.readVInt(signed, input); } else { numLiterals = 0x100 - control; used = 0; repeat = false; for (int i = 0; i < numLiterals; ++i) { literals[i] = LongDecode.readVInt(signed, input); } } }
writeVLong(output, value, signed); Slice prestoBytes = Slices.copyOf(output.slice()); if (!prestoBytes.equals(hiveBytes)) { long readValueNew = readVInt(signed, new OrcInputStream(new OrcDataSourceId("test"), hiveBytes.getInput(), Optional.empty(), newSimpleAggregatedMemoryContext(), hiveBytes.getRetainedSize())); assertEquals(readValueNew, value);
@Override public void writeLong(long value) { checkState(!closed); writeVLong(buffer, value, signed); }
public static long readSignedVInt(InputStream inputStream) throws IOException { long result = readUnsignedVInt(inputStream); return (result >>> 1) ^ -(result & 1); }
public static long readDwrfLong(OrcInputStream input, OrcTypeKind type, boolean signed, boolean usesVInt) throws IOException { if (usesVInt) { return readVInt(signed, input); } else if (type == SHORT) { return input.read() | (input.read() << 8); } else if (type == INT) { return input.read() | (input.read() << 8) | (input.read() << 16) | (input.read() << 24); } else if (type == LONG) { return ((long) input.read()) | (((long) input.read()) << 8) | (((long) input.read()) << 16) | (((long) input.read()) << 24) | (((long) input.read()) << 32) | (((long) input.read()) << 40) | (((long) input.read()) << 48) | (((long) input.read()) << 56); } else { throw new IllegalArgumentException(type + " type is not supported"); } }
writeVLong(output, value, signed); Slice prestoBytes = Slices.copyOf(output.slice()); if (!prestoBytes.equals(hiveBytes)) { long readValueNew = readVInt(signed, new OrcInputStream(new OrcDataSourceId("test"), hiveBytes.getInput(), Optional.empty(), newSimpleAggregatedMemoryContext(), hiveBytes.getRetainedSize())); assertEquals(readValueNew, value);
public void writeUnscaledValue(long value) { checkState(!closed); writeVLong(buffer, value, true); }
public static long readSignedVInt(OrcInputStream inputStream) throws IOException { long result = readUnsignedVInt(inputStream); return zigzagDecode(result); }
public static void writeVLong(SliceOutput buffer, long value, boolean signed) { if (signed) { value = zigzagEncode(value); } writeVLongUnsigned(buffer, value); }
fixedBits = LongDecode.decodeBitWidth(fixedBits); long firstVal = LongDecode.readVInt(signed, input); long fixedDelta = LongDecode.readSignedVInt(input); long deltaBase = LongDecode.readSignedVInt(input);
public static long readDwrfLong(InputStream input, OrcTypeKind type, boolean signed, boolean usesVInt) throws IOException { if (usesVInt) { return readVInt(signed, input); } else if (type == SHORT) { return input.read() | (input.read() << 8); } else if (type == INT) { return input.read() | (input.read() << 8) | (input.read() << 16) | (input.read() << 24); } else if (type == LONG) { return ((long) input.read()) | (((long) input.read()) << 8) | (((long) input.read()) << 16) | (((long) input.read()) << 24) | (((long) input.read()) << 32) | (((long) input.read()) << 40) | (((long) input.read()) << 48) | (((long) input.read()) << 56); } else { throw new IllegalArgumentException(type + " type is not supported"); } } }
public static long readVInt(boolean signed, InputStream inputStream) throws IOException { if (signed) { return readSignedVInt(inputStream); } else { return readUnsignedVInt(inputStream); } }
private void flushLiteralSequence(int literalCount) { verify(literalCount > 0); buffer.writeByte(-literalCount); for (int i = 0; i < literalCount; i++) { writeVLong(buffer, sequenceBuffer[i], signed); } }
@Override public long next() throws IOException { return readDwrfLong(input, orcTypeKind, signed, usesVInt); } }
fixedBits = LongDecode.decodeBitWidth(fixedBits); long firstVal = LongDecode.readVInt(signed, input); long fixedDelta = LongDecode.readSignedVInt(input); long deltaBase = LongDecode.readSignedVInt(input);