| 150 | } |
| 151 | |
| 152 | Status AggFn::CodegenUpdateOrMergeFunction( |
| 153 | LlvmCodeGen* codegen, llvm::Function** uda_fn) { |
| 154 | const string& symbol = |
| 155 | is_merge_ ? fn_.aggregate_fn.merge_fn_symbol : fn_.aggregate_fn.update_fn_symbol; |
| 156 | vector<ColumnType> fn_arg_types; |
| 157 | for (ScalarExpr* input_expr : children()) { |
| 158 | fn_arg_types.push_back(input_expr->type()); |
| 159 | } |
| 160 | // The intermediate value is passed as the last argument. |
| 161 | fn_arg_types.push_back(intermediate_type()); |
| 162 | RETURN_IF_ERROR(codegen->LoadFunction(fn_, symbol, nullptr, fn_arg_types, |
| 163 | fn_arg_types.size(), false, uda_fn, &cache_entry_)); |
| 164 | |
| 165 | // Inline constants into the function body (if there is an IR body). |
| 166 | if (!(*uda_fn)->isDeclaration()) { |
| 167 | // TODO: IMPALA-4785: we should also replace references to GetIntermediateType() |
| 168 | // with constants. |
| 169 | codegen->InlineConstFnAttrs(GetOutputTypeDesc(), arg_type_descs_, *uda_fn); |
| 170 | *uda_fn = codegen->FinalizeFunction(*uda_fn); |
| 171 | if (*uda_fn == nullptr) { |
| 172 | return Status(TErrorCode::UDF_VERIFY_FAILED, symbol, fn_.hdfs_location); |
| 173 | } |
| 174 | } |
| 175 | return Status::OK(); |
| 176 | } |
| 177 | |
| 178 | void AggFn::Close() { |
| 179 | // This also closes all the input expressions. |
no test coverage detected