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

Method GetNextBuffer

be/src/exec/json/hdfs-json-scanner.cc:304–342  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

302}
303
304void HdfsJsonScanner::GetNextBuffer(const char** begin, const char** end) {
305 DCHECK(*begin == *end);
306 SCOPED_TIMER(get_buffer_timer_);
307
308 // The eosr indicates that we have scanned all data within the scan range. If the
309 // scanner state is OPENED, it means that we encountered eosr in FindFirstTuple(),
310 // indicating that there is no start of tuple in this scan range, this will be handle by
311 // the previous scan range in the same file. If the scanner state is SCANNING, it means
312 // that we have completed scanning the data within the range, and need to read the next
313 // range of data to complete the scan.
314 if (stream_->eosr()) {
315 if (scanner_state_ == OPENED) return;
316 if (scanner_state_ == SCANNING) scanner_state_ = PAST_SCANNING;
317 }
318
319 if (stream_->eof() || scanner_state_ == FINISHED) return;
320
321 uint8_t* next_buffer_begin = nullptr;
322 int64_t next_buffer_size = 0;
323 if (decompressor_ == nullptr) {
324 buffer_status_ = FillBytesToBuffer(&next_buffer_begin, &next_buffer_size);
325 } else if (decompressor_->supports_streaming()) {
326 bool eosr = false;
327 // The JsonParser always copies values instead of referencing them, so it doesn't
328 // reference the data in the data_buffer_pool_. Therefore, we don't need current_pool_
329 // to acquire data from the data_buffer_pool_, so we pass nullptr to
330 // DecompressStreamToBuffer().
331 buffer_status_ = DecompressStreamToBuffer(&next_buffer_begin, &next_buffer_size,
332 nullptr, &eosr);
333 } else {
334 buffer_status_ = DecompressFileToBuffer(&next_buffer_begin, &next_buffer_size);
335 if (next_buffer_size == 0) scanner_state_ = FINISHED;
336 }
337 RETURN_VOID_IF_ERROR(buffer_status_);
338 if (UNLIKELY(next_buffer_size == 0)) return;
339
340 *begin = reinterpret_cast<char*>(next_buffer_begin);
341 *end = *begin + next_buffer_size;
342}
343
344void HdfsJsonScanner::InitRow() {
345 InitTuple(template_tuple_, tuple_);

Callers

nothing calls this directly

Calls 3

eofMethod · 0.80
supports_streamingMethod · 0.80
eosrMethod · 0.45

Tested by

no test coverage detected