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

Method ReadValueInternal

be/src/exec/orc/orc-column-readers.cc:262–303  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

260
261template<PrimitiveType SLOT_TYPE, bool ENCODED>
262Status OrcStringColumnReader::ReadValueInternal(int row_idx, Tuple* tuple) {
263 if (IsNull(DCHECK_NOTNULL(batch_), row_idx)) {
264 SetNullSlot(tuple);
265 return Status::OK();
266 }
267 char* src_ptr;
268 int src_len;
269
270 if (ENCODED) {
271 DCHECK(batch_->isEncoded);
272 orc::EncodedStringVectorBatch* currentBatch =
273 static_cast<orc::EncodedStringVectorBatch*>(batch_);
274
275 orc::DataBuffer<int64_t>& offsets = currentBatch->dictionary->dictionaryOffset;
276 int64_t index = currentBatch->index[row_idx];
277 if (UNLIKELY(index < 0 || static_cast<uint64_t>(index) + 1 >= offsets.size())) {
278 return Status(Substitute("Corrupt ORC file: $0. Index ($1) out of range [0, $2) in "
279 "StringDictionary.", scanner_->filename(), index, offsets.size()));;
280 }
281 src_ptr = blob_ + offsets[index];
282 src_len = offsets[index + 1] - offsets[index];
283 } else {
284 // The pointed data is now in blob_, a buffer handled by Impala.
285 src_ptr = blob_ + (batch_->data[row_idx] - batch_->blob.data());
286 src_len = batch_->length[row_idx];
287 }
288 int dst_len = slot_desc_->type().len;
289 if (SLOT_TYPE == TYPE_CHAR) {
290 DCHECK_EQ(slot_desc_->type().type, TYPE_CHAR);
291 int unpadded_len = min(dst_len, static_cast<int>(src_len));
292 char* dst_char = reinterpret_cast<char*>(GetSlot(tuple));
293 memcpy(dst_char, src_ptr, unpadded_len);
294 StringValue::PadWithSpaces(dst_char, dst_len, unpadded_len);
295 return Status::OK();
296 }
297 StringValue* dst = reinterpret_cast<StringValue*>(GetSlot(tuple));
298 dst->Assign(src_ptr, src_len);
299 if (SLOT_TYPE == TYPE_VARCHAR && dst_len < src_len) {
300 dst->SetLen(dst_len);
301 }
302 return Status::OK();
303}
304
305Status OrcTimestampReader::ReadValue(int row_idx, Tuple* tuple, MemPool* pool) {
306 if (IsNull(DCHECK_NOTNULL(batch_), row_idx)) {

Callers

nothing calls this directly

Calls 10

OKFunction · 0.85
SubstituteFunction · 0.85
minFunction · 0.85
StatusClass · 0.50
sizeMethod · 0.45
filenameMethod · 0.45
dataMethod · 0.45
typeMethod · 0.45
AssignMethod · 0.45
SetLenMethod · 0.45

Tested by

no test coverage detected