Impala
Impalaistheopensource,nativeanalyticdatabaseforApacheHadoop.
|
#include <read-write-util.h>
Public Member Functions | |
template<> | |
uint16_t | GetInt (const uint8_t *buf) |
template<> | |
uint32_t | GetInt (const uint8_t *buf) |
template<> | |
uint64_t | GetInt (const uint8_t *buf) |
Static Public Member Functions | |
static int | PutZInt (int32_t integer, uint8_t *buf) |
Put a zigzag encoded integer into a buffer and return its length. More... | |
static int | PutZLong (int64_t longint, uint8_t *buf) |
Put a zigzag encoded long integer into a buffer and return its length. More... | |
template<typename T > | |
static T | GetInt (const uint8_t *buffer) |
Get a big endian integer from a buffer. The buffer does not have to be word aligned. More... | |
static int | GetVLong (uint8_t *buf, int64_t *vlong) |
static int | GetVInt (uint8_t *buf, int32_t *vint) |
static int64_t | PutVLong (int64_t val, uint8_t *buf) |
static int64_t | PutVInt (int32_t val, uint8_t *buf) |
static int | VLongRequiredBytes (int64_t val) |
returns size of the encoded long value, not including the 1 byte for length More... | |
static int | GetVLong (uint8_t *buf, int64_t offset, int64_t *vlong) |
static void | PutInt (uint8_t *buf, uint16_t integer) |
static void | PutInt (uint8_t *buf, uint32_t integer) |
static void | PutInt (uint8_t *buf, uint64_t integer) |
static std::string | HexDump (const uint8_t *buf, int64_t length) |
Dump the first length bytes of buf to a Hex string. More... | |
static std::string | HexDump (const char *buf, int64_t length) |
static bool | IsNegativeVInt (int8_t byte) |
Determines the sign of a VInt/VLong from the first byte. More... | |
static int | DecodeVIntSize (int8_t byte) |
Determines the total length in bytes of a Writable VInt/VLong from the first byte. More... | |
static int64_t | ReadZLong (uint8_t **buf) |
static int32_t | ReadZInt (uint8_t **buf) |
Read a zig-zag encoded int. More... | |
template<class T > | |
static bool | Read (uint8_t **buf, int *buf_len, T *val, Status *status) |
static bool | SkipBytes (uint8_t **buf, int *buf_len, int num_bytes, Status *status) |
Skip the next num_bytes bytes. More... | |
Static Public Attributes | |
static const int | MAX_VINT_LEN = 9 |
Maximum length for Writeable VInt. More... | |
static const int | MAX_ZINT_LEN = 5 |
Maximum lengths for Zigzag encodings. More... | |
static const int | MAX_ZLONG_LEN = 10 |
Class for reading and writing various data types. Note: be very careful using signed ints. Casting from a signed int to an unsigned is not a problem. However, bit shifts will do sign extension on unsigned ints, which is rarely the right thing to do for byte level operations.
Definition at line 34 of file read-write-util.h.
|
inlinestatic |
Determines the total length in bytes of a Writable VInt/VLong from the first byte.
Definition at line 254 of file read-write-util.h.
Referenced by GetVLong(), and impala::ScannerContext::Stream::ReadVLong().
|
static |
Get a big endian integer from a buffer. The buffer does not have to be word aligned.
|
inline |
Definition at line 110 of file read-write-util.h.
|
inline |
Definition at line 115 of file read-write-util.h.
|
inline |
Definition at line 120 of file read-write-util.h.
|
inlinestatic |
Definition at line 141 of file read-write-util.h.
References GetVLong().
Referenced by impala::HdfsRCFileScanner::GetCurrentKeyBuffer(), and impala::HdfsRCFileScanner::ReadKeyBuffers().
|
inlinestatic |
Get a variable-length Long or int value from a byte buffer. Returns the length of the long/int If the size byte is corrupted then return -1;
Definition at line 148 of file read-write-util.h.
Referenced by impala::HdfsSequenceScanner::GetRecord(), GetVInt(), impala::HdfsRCFileScanner::NextField(), and impala::HdfsSequenceScanner::ProcessDecompressedBlock().
|
inlinestatic |
Read a variable-length Long value from a byte buffer starting at the specified byte offset.
Definition at line 152 of file read-write-util.h.
References DecodeVIntSize(), IsNegativeVInt(), and MAX_VINT_LEN.
|
static |
Dump the first length bytes of buf to a Hex string.
Definition at line 72 of file read-write-util.cc.
Referenced by HexDump(), impala::HdfsAvroScanner::ReadFileHeader(), impala::HdfsSequenceScanner::ReadFileHeader(), impala::HdfsRCFileScanner::ReadFileHeader(), and impala::BaseSequenceScanner::ReadSync().
|
static |
Definition at line 81 of file read-write-util.cc.
References HexDump().
|
inlinestatic |
Determines the sign of a VInt/VLong from the first byte.
Definition at line 250 of file read-write-util.h.
Referenced by GetVLong(), and impala::ScannerContext::Stream::ReadVLong().
|
inlinestatic |
Put an Integer into a buffer in big endian order. The buffer must be big enough.
Definition at line 126 of file read-write-util.h.
Referenced by impala::HdfsSequenceTableWriter::Init(), impala::SnappyBlockCompressor::ProcessBlock(), impala::TestBigEndian(), and impala::WriteStream::WriteInt().
|
inlinestatic |
Definition at line 131 of file read-write-util.h.
References impala::BitUtil::ByteSwap().
|
inlinestatic |
Definition at line 136 of file read-write-util.h.
References impala::BitUtil::ByteSwap().
|
inlinestatic |
Definition at line 212 of file read-write-util.h.
References PutVLong().
Referenced by impala::WriteStream::WriteVInt().
|
inlinestatic |
Writes a variable-length Long or int value to a byte buffer. Returns the number of bytes written
Definition at line 191 of file read-write-util.h.
References VLongRequiredBytes().
Referenced by PutVInt(), and impala::WriteStream::WriteVLong().
|
static |
Put a zigzag encoded integer into a buffer and return its length.
Definition at line 38 of file read-write-util.cc.
Referenced by impala::TestZInt(), and impala::WriteStream::WriteZInt().
|
static |
Put a zigzag encoded long integer into a buffer and return its length.
Definition at line 55 of file read-write-util.cc.
Referenced by impala::TestZLong(), and impala::WriteStream::WriteZLong().
|
inlinestatic |
The following methods read data from a buffer without assuming the buffer is long enough. If the buffer isn't long enough or another error occurs, they return false and update the status with the error. Otherwise they return true. buffer is advanced past the data read and buf_len is decremented appropriately. Read a native type T (e.g. bool, float) directly into output (i.e. input is cast directly to T and incremented by sizeof(T)).
Definition at line 222 of file read-write-util.h.
References UNLIKELY.
Referenced by impala::HdfsParquetScanner::BaseColumnReader::ReadDataPage().
|
inlinestatic |
Read a zig-zag encoded int.
Definition at line 216 of file read-write-util.h.
References ReadZLong().
Referenced by impala::HdfsAvroScanner::ReadAvroInt32(), and impala::TestZInt().
|
static |
Read a zig-zag encoded long. This is the integer encoding defined by google.com protocol-buffers: https://developers.google.com/protocol-buffers/docs/encoding *buf is incremented past the encoded long.
Definition at line 24 of file read-write-util.cc.
Referenced by impala::HdfsAvroScanner::ReadAvroChar(), impala::HdfsAvroScanner::ReadAvroDecimal(), impala::HdfsAvroScanner::ReadAvroInt64(), impala::HdfsAvroScanner::ReadAvroString(), impala::HdfsAvroScanner::ReadAvroVarchar(), ReadZInt(), and impala::TestZLong().
|
inlinestatic |
Skip the next num_bytes bytes.
Definition at line 236 of file read-write-util.h.
References UNLIKELY.
|
inlinestatic |
returns size of the encoded long value, not including the 1 byte for length
Definition at line 175 of file read-write-util.h.
Referenced by impala::HdfsSequenceTableWriter::ConsumeRow(), and PutVLong().
|
static |
Maximum length for Writeable VInt.
Definition at line 37 of file read-write-util.h.
Referenced by GetVLong(), impala::ScannerContext::Stream::ReadVLong(), impala::WriteStream::WriteVInt(), and impala::WriteStream::WriteVLong().
|
static |
Maximum lengths for Zigzag encodings.
Definition at line 40 of file read-write-util.h.
Referenced by impala::TestZInt(), and impala::WriteStream::WriteZInt().
|
static |
Definition at line 41 of file read-write-util.h.
Referenced by impala::TestZLong(), and impala::WriteStream::WriteZLong().