| 91 | } |
| 92 | |
| 93 | Status HdfsScanner::Open(ScannerContext* context) { |
| 94 | context_ = context; |
| 95 | RETURN_IF_ERROR(ValidateSlotDescriptors()); |
| 96 | file_metadata_utils_.SetFile(state_, scan_node_->GetFileDesc( |
| 97 | context->partition_descriptor()->id(), context->GetStream()->filename())); |
| 98 | stream_ = context->GetStream(); |
| 99 | |
| 100 | // Clone the scan node's conjuncts map. The cloned evaluators must be closed by the |
| 101 | // caller. |
| 102 | for (const auto& entry: scan_node_->conjuncts_map()) { |
| 103 | RETURN_IF_ERROR(ScalarExprEvaluator::Clone(&obj_pool_, scan_node_->runtime_state(), |
| 104 | expr_perm_pool_.get(), context_->expr_results_pool(), entry.second, |
| 105 | &conjunct_evals_map_[entry.first])); |
| 106 | } |
| 107 | DCHECK(conjunct_evals_map_.find(scan_node_->tuple_desc()->id()) != |
| 108 | conjunct_evals_map_.end()); |
| 109 | conjunct_evals_ = &conjunct_evals_map_[scan_node_->tuple_desc()->id()]; |
| 110 | |
| 111 | // Set up the scan node's dictionary filtering conjuncts map. |
| 112 | if (scan_node_->thrift_dict_filter_conjuncts_map() != nullptr) { |
| 113 | for (auto& entry : *(scan_node_->thrift_dict_filter_conjuncts_map())) { |
| 114 | SlotDescriptor* slot_desc = state_->desc_tbl().GetSlotDescriptor(entry.first); |
| 115 | TupleId tuple_id = (slot_desc->type().IsCollectionType() ? |
| 116 | slot_desc->children_tuple_descriptor()->id() : |
| 117 | slot_desc->parent()->id()); |
| 118 | auto conjunct_evals_it = conjunct_evals_map_.find(tuple_id); |
| 119 | DCHECK(conjunct_evals_it != conjunct_evals_map_.end()); |
| 120 | const vector<ScalarExprEvaluator*>& conjunct_evals = conjunct_evals_it->second; |
| 121 | |
| 122 | // Convert this slot's list of conjunct indices into a list of pointers |
| 123 | // into conjunct_evals_. |
| 124 | for (int conjunct_idx : entry.second) { |
| 125 | DCHECK_LT(conjunct_idx, conjunct_evals.size()); |
| 126 | DCHECK((conjunct_evals)[conjunct_idx] != nullptr); |
| 127 | dict_filter_map_[entry.first].push_back((conjunct_evals)[conjunct_idx]); |
| 128 | } |
| 129 | } |
| 130 | } |
| 131 | |
| 132 | std::map<const SlotId, const SlotDescriptor*> slot_descs_written; |
| 133 | template_tuple_ = file_metadata_utils_.CreateTemplateTuple( |
| 134 | context_->partition_descriptor()->id(), template_tuple_pool_.get(), |
| 135 | &slot_descs_written); |
| 136 | template_tuple_map_[scan_node_->tuple_desc()] = template_tuple_; |
| 137 | |
| 138 | decompress_timer_ = ADD_TIMER(scan_node_->runtime_profile(), "DecompressionTime"); |
| 139 | return Status::OK(); |
| 140 | } |
| 141 | |
| 142 | Status HdfsScanner::ProcessSplit() { |
| 143 | DCHECK(scan_node_->HasRowBatchQueue()); |
nothing calls this directly
no test coverage detected