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); } } }
long firstVal = LongDecode.readVInt(signed, input);
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"); } }
long readValueNew = readVInt(signed, new OrcInputStream(new OrcDataSourceId("test"), hiveBytes.getInput(), Optional.empty(), newSimpleAggregatedMemoryContext(), hiveBytes.getRetainedSize())); assertEquals(readValueNew, value);
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"); } } }
private void readValues() throws IOException { lastReadInputCheckpoint = input.getCheckpoint(); int control = input.read(); if (control == -1) { throw new OrcCorruptionException("Read past end of RLE integer from %s", input); } if (control < 0x80) { numLiterals = control + MIN_REPEAT_SIZE; used = 0; repeat = true; delta = input.read(); if (delta == -1) { throw new OrcCorruptionException("End of stream in RLE Integer from %s", input); } // 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); } } }
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); } } }
long firstVal = LongDecode.readVInt(signed, input);
long firstVal = LongDecode.readVInt(signed, input);
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"); } }
long readValueNew = readVInt(signed, new OrcInputStream(new OrcDataSourceId("test"), hiveBytes.getInput(), Optional.empty(), newSimpleAggregatedMemoryContext(), hiveBytes.getRetainedSize())); assertEquals(readValueNew, value);