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

Method GetNext

be/src/exec/hdfs-scan-node-mt.cc:65–130  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

63}
64
65Status HdfsScanNodeMt::GetNext(RuntimeState* state, RowBatch* row_batch, bool* eos) {
66 SCOPED_TIMER(runtime_profile_->total_time_counter());
67 ScopedGetNextEventAdder ea(this, eos);
68 RETURN_IF_ERROR(ExecDebugAction(TExecNodePhase::GETNEXT, state));
69 RETURN_IF_CANCELLED(state);
70 RETURN_IF_ERROR(QueryMaintenance(state));
71 *eos = false;
72
73 DCHECK(scan_range_ == NULL || scanner_ != NULL);
74 if (scan_range_ == NULL || scanner_->eos()) {
75 if (scanner_ != NULL && scanner_->eos()) {
76 scanner_->Close(row_batch);
77 scanner_.reset();
78 }
79 int64_t scanner_reservation = buffer_pool_client()->GetReservation();
80 RETURN_IF_ERROR(StartNextScanRange(filter_ctxs_, &scanner_reservation, &scan_range_));
81 if (scan_range_ == nullptr) {
82 *eos = true;
83 StopAndFinalizeCounters();
84 return Status::OK();
85 }
86 ScanRangeMetadata* metadata =
87 static_cast<ScanRangeMetadata*>(scan_range_->meta_data());
88 HdfsPartitionDescriptor* partition =
89 hdfs_table_->GetPartition(metadata->partition_id);
90 DCHECK(partition != nullptr);
91 scanner_ctx_.reset(new ScannerContext(runtime_state_, this, buffer_pool_client(),
92 scanner_reservation, partition, filter_ctxs(), expr_results_pool()));
93 scanner_ctx_->AddStream(scan_range_, scanner_reservation);
94 Status status = CreateAndOpenScanner(partition, scanner_ctx_.get(), &scanner_);
95 if (!status.ok()) {
96 DCHECK(scanner_ == NULL);
97 // Avoid leaking unread buffers in the scan range.
98 scan_range_->Cancel(status);
99 return status;
100 }
101 }
102
103 // We only need one row per partition. Limit the capacity to prevent the scanner
104 // materialising extra rows.
105 if (is_partition_key_scan_) row_batch->limit_capacity(1);
106 Status status = scanner_->GetNext(row_batch);
107 if (!status.ok()) {
108 scanner_->Close(row_batch);
109 scanner_.reset();
110 return status;
111 }
112 InitNullCollectionValues(row_batch);
113
114 if (CheckLimitAndTruncateRowBatchIfNeeded(row_batch, eos)) {
115 scan_range_ = NULL;
116 scanner_->Close(row_batch);
117 scanner_.reset();
118 *eos = true;
119 } else if (row_batch->num_rows() > 0 && is_partition_key_scan_) {
120 // Only return one from each scan range.
121 scanner_->Close(row_batch);
122 scanner_.reset();

Callers

nothing calls this directly

Calls 14

OKFunction · 0.85
total_time_counterMethod · 0.80
meta_dataMethod · 0.80
GetPartitionMethod · 0.80
AddStreamMethod · 0.80
limit_capacityMethod · 0.80
resetMethod · 0.65
getMethod · 0.65
eosMethod · 0.45
CloseMethod · 0.45
GetReservationMethod · 0.45
okMethod · 0.45

Tested by

no test coverage detected