Tim Armstrong has posted comments on this change.

Change subject: IMPALA-1430: enable codegen for native UDAs
......................................................................


Patch Set 6:

(7 comments)

http://gerrit.cloudera.org:8080/#/c/5161/6/be/src/exprs/agg-fn-evaluator.cc
File be/src/exprs/agg-fn-evaluator.cc:

PS6, Line 542:     
Expr::InlineConstants(AnyValUtil::ColumnTypeToTypeDesc(intermediate_type()),
             :         AnyValUtil::ColumnTypesToTypeDescs(arg_types), codegen, 
*uda_fn);
> I am not sure I understand the intention of this.
This is preserving the pre-existing behaviour of the UDA interface, which 
treats the last (in-out) argument as the return type in the function context. 
Changing how the types are exposed could break UDAs that were written against 
the old interface. I updated the comment to hopefully make this clearer.

I don't feel strongly about whether this is the right API (on one hand, it 
doesn't match the C++ function signature, on the other the intermediate type is 
logically the return type) but I don't think it's worth breaking compatibility 
for.

The constants aren't inlined into the input expressions, only to the UDA 
function itself, so the second scenario isn't possible.


http://gerrit.cloudera.org:8080/#/c/5161/6/be/src/exprs/scalar-fn-call.cc
File be/src/exprs/scalar-fn-call.cc:

PS6, Line 327: !udf->isDeclaration()
> May help to add a comment on why this can be a declaration only (i.e. no fu
Done


PS6, Line 328:     InlineConstants(AnyValUtil::ColumnTypeToTypeDesc(type_),
             :         AnyValUtil::ColumnTypesToTypeDescs(arg_types), codegen, 
udf);
> Please see comments in AggFnEvaluator. It seems that we should be able to k
That was the initial path I took but it's not possible because UDAs treat the 
final in/out argument as the return type. I could pass in an additional 
argument to determine which mode it should use if you prefer.


PS6, Line 449:   DCHECK(has_varargs || arg_types.size() == num_fixed_args);
             :   DCHECK(!has_varargs || arg_types.size() > num_fixed_args);
> DCHECK(arg_types.size() == num_fixed_args ||  (has_var_args && arg_types.si
We actually want to reject the case of passing 0 varargs into a varargs 
function. The frontend currently rejects those cases and I added a comment to 
this function that specifically mentions this case.

It would be reasonable to pass 0 args into varargs functions, but a bunch of 
code here doesn't handle that correctly - it assumes that having 0 varargs 
means that the function signature doesn't have a varargs argument.


PS6, Line 478:         codegen->void_type() :
             :         CodegenAnyVal::GetLoweredType(codegen, *return_type);
> nit: one line ?
clang-format seems to prefer it this way. I don't feel strongly


http://gerrit.cloudera.org:8080/#/c/5161/6/be/src/exprs/scalar-fn-call.h
File be/src/exprs/scalar-fn-call.h:

PS6, Line 59: 'cache_entry'
> May help to have a comment about what 'cache_entry' is. Something like the 
Done


Line 60:   /// updated to point to the library (or its use count is incremented 
if already loaded).
> Please add a comment that the caller is expected to call FinalizeFunction()
Done


-- 
To view, visit http://gerrit.cloudera.org:8080/5161
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Id1708eaa96eb76fb9bec5eeabf209f81c88eec2f
Gerrit-PatchSet: 6
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-Owner: Tim Armstrong <[email protected]>
Gerrit-Reviewer: Marcel Kornacker <[email protected]>
Gerrit-Reviewer: Michael Ho
Gerrit-Reviewer: Michael Ho <[email protected]>
Gerrit-Reviewer: Tim Armstrong <[email protected]>
Gerrit-HasComments: Yes

Reply via email to