MCPcopy Create free account
hub / github.com/apache/impala / ReadVLong

Method ReadVLong

be/src/exec/scanner-context.inline.h:142–172  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

140}
141
142inline bool ScannerContext::Stream::ReadVLong(int64_t* value, Status* status) {
143 int8_t* firstbyte;
144 uint8_t* bytes;
145
146 RETURN_IF_FALSE(ReadBytes(1, reinterpret_cast<uint8_t**>(&firstbyte), status));
147
148 int len = ReadWriteUtil::DecodeVIntSize(*firstbyte);
149 bool is_negative = ReadWriteUtil::IsNegativeVInt(*firstbyte);
150 if (len > ReadWriteUtil::MAX_VINT_LEN) {
151 *status = Status("ReadVLong: size is too big");
152 return false;
153 }
154
155 if (len == 1) {
156 *value = static_cast<int64_t>(*firstbyte);
157 return true;
158 }
159 --len;
160
161 RETURN_IF_FALSE(ReadBytes(len, &bytes, status));
162
163 *value = 0;
164
165 for (int i = 0; i < len; i++) {
166 *value = (*value << 8) | (bytes[i] & 0xFF);
167 }
168
169 if (is_negative) *value = *value ^ (static_cast<int64_t>(-1));
170
171 return true;
172}
173
174inline bool ScannerContext::Stream::ReadZLong(int64_t* value, Status* status) {
175 uint8_t* bytes;

Callers 2

GetRecordMethod · 0.80
ReadCompressedBlockMethod · 0.80

Calls 1

StatusClass · 0.70

Tested by

no test coverage detected