| 165 | } |
| 166 | |
| 167 | Status HdfsColumnarScanner::Codegen(HdfsScanPlanNode* node, FragmentState* state, |
| 168 | llvm::Function** process_scratch_batch_fn) { |
| 169 | DCHECK(state->ShouldCodegen()); |
| 170 | *process_scratch_batch_fn = nullptr; |
| 171 | LlvmCodeGen* codegen = state->codegen(); |
| 172 | DCHECK(codegen != nullptr); |
| 173 | |
| 174 | llvm::Function* fn = codegen->GetFunction(IRFunction::PROCESS_SCRATCH_BATCH, true); |
| 175 | DCHECK(fn != nullptr); |
| 176 | |
| 177 | llvm::Function* eval_conjuncts_fn; |
| 178 | const vector<ScalarExpr*>& conjuncts = node->conjuncts_; |
| 179 | RETURN_IF_ERROR(ExecNode::CodegenEvalConjuncts(codegen, conjuncts, &eval_conjuncts_fn)); |
| 180 | DCHECK(eval_conjuncts_fn != nullptr); |
| 181 | |
| 182 | int replaced = codegen->ReplaceCallSites(fn, eval_conjuncts_fn, "EvalConjuncts"); |
| 183 | DCHECK_REPLACE_COUNT(replaced, 1); |
| 184 | |
| 185 | llvm::Function* eval_runtime_filters_fn; |
| 186 | RETURN_IF_ERROR(CodegenEvalRuntimeFilters( |
| 187 | codegen, node->runtime_filter_exprs_, &eval_runtime_filters_fn)); |
| 188 | DCHECK(eval_runtime_filters_fn != nullptr); |
| 189 | |
| 190 | replaced = codegen->ReplaceCallSites(fn, eval_runtime_filters_fn, "EvalRuntimeFilters"); |
| 191 | DCHECK_REPLACE_COUNT(replaced, 1); |
| 192 | |
| 193 | fn->setName("ProcessScratchBatch"); |
| 194 | *process_scratch_batch_fn = codegen->FinalizeFunction(fn); |
| 195 | if (*process_scratch_batch_fn == nullptr) { |
| 196 | return Status("Failed to finalize process_scratch_batch_fn."); |
| 197 | } |
| 198 | return Status::OK(); |
| 199 | } |
| 200 | |
| 201 | int HdfsColumnarScanner::ProcessScratchBatchCodegenOrInterpret(RowBatch* dst_batch) { |
| 202 | return CallCodegendOrInterpreted<ProcessScratchBatchFn>::invoke(this, |
nothing calls this directly
no test coverage detected