16 #ifndef IMPALA_EXEC_SCANNER_CONTEXT_INLINE_H
17 #define IMPALA_EXEC_SCANNER_CONTEXT_INLINE_H
23 using namespace impala;
26 #define RETURN_IF_FALSE(x) if (UNLIKELY(!(x))) return false
32 int64_t* out_len,
Status* status,
bool peek) {
42 *out_len = requested_len;
51 DCHECK_GT(requested_len, 0);
57 Status* status,
bool peek) {
60 if (
UNLIKELY(length != bytes_read)) {
61 DCHECK_LT(bytes_read, length);
62 *status = ReportIncompleteRead(length, bytes_read);
74 if (
UNLIKELY(length != bytes_read)) {
75 DCHECK_LT(bytes_read, length);
76 *status = ReportIncompleteRead(length, bytes_read);
83 uint8_t* dummy_buffer;
85 return ReadText(&dummy_buffer, &bytes_read, status);
105 *val = ReadWriteUtil::GetInt<uint32_t>(bytes);
112 *value =
static_cast<int32_t
>(vlong);
120 RETURN_IF_FALSE(ReadBytes(1, reinterpret_cast<uint8_t**>(&firstbyte), status));
124 *status =
Status(
"ReadVLong: size is too big");
129 *value =
static_cast<int64_t
>(*firstbyte);
138 for (
int i = 0; i < len; i++) {
139 *value = (*value << 8) | (bytes[i] & 0xFF);
143 *value = *value ^ (
static_cast<int64_t
>(-1));
153 DCHECK_LE(shift, 64);
155 zlong |=
static_cast<uint64_t>(*byte & 0x7f) << shift;
157 }
while (*byte & 0x80);
158 *value = (zlong >> 1) ^ -(zlong & 1);
162 #undef RETURN_IF_FALSE
bool SkipText(Status *)
Skip this text object.
static int DecodeVIntSize(int8_t byte)
Determines the total length in bytes of a Writable VInt/VLong from the first byte.
uint8_t ** output_buffer_pos_
bool ReadInt(int32_t *val, Status *, bool peek=false)
bool ReadBoolean(bool *boolean, Status *)
bool ReadVLong(int64_t *val, Status *)
bool ReadZLong(int64_t *val, Status *)
Read a zigzag encoded long.
bool ReadText(uint8_t **buf, int64_t *length, Status *)
#define RETURN_IF_FALSE(x)
Macro to return false if condition is false. Only defined for this file.
int64_t * output_buffer_bytes_left_
Status GetBytesInternal(int64_t requested_len, uint8_t **buffer, bool peek, int64_t *out_len)
bool GetBytes(int64_t requested_len, uint8_t **buffer, int64_t *out_len, Status *status, bool peek=false)
bool ReadVInt(int32_t *val, Status *)
bool SkipBytes(int64_t length, Status *)
Skip over the next length bytes in the specified HDFS file.
int64_t total_bytes_returned_
Total number of bytes returned from GetBytes()
static bool IsNegativeVInt(int8_t byte)
Determines the sign of a VInt/VLong from the first byte.
Status ReportInvalidRead(int64_t length)
bool ReadBytes(int64_t length, uint8_t **buf, Status *, bool peek=false)
static const int MAX_VINT_LEN
Maximum length for Writeable VInt.