Balazs Hevele has posted comments on this change. ( 
https://gerrit.cloudera.org/24674 )

Change subject: IMPALA-15252: Add Python UDF support
......................................................................


Patch Set 9:

(16 comments)

https://gerrit.cloudera.org/#/c/24674/9/be/src/common/status-or.h
File be/src/common/status-or.h:

https://gerrit.cloudera.org/#/c/24674/9/be/src/common/status-or.h@31
PS9, Line 31: StatusOr(Status&& error) : ok_(false), 
result_(std::forward<Status>(error)) {}
If this is only supposed to have been called with an error, can you add a 
DCHECK(!error.ok())?


https://gerrit.cloudera.org/#/c/24674/9/be/src/exec/aggregation-node-base.cc
File be/src/exec/aggregation-node-base.cc:

https://gerrit.cloudera.org/#/c/24674/9/be/src/exec/aggregation-node-base.cc@37
PS9, Line 37: std::optional<FragmentState::ScopedBatchedEvaluationSupport> 
batched_eval_support;
This looks to be in the wrong block.
Currently, in the loop, the scope object will be created once a non-grouping 
aggregator is found, and it will only be deleted at the end of the loop.
So for a grouping aggregator:
-the scope will not exist if a non-grouping aggregator was not yet encountered
-the scope will exist if a non-grouping aggregator was already encountered
It looks wrong.
Isn't this supposed to be placed inside the for loop's block?


https://gerrit.cloudera.org/#/c/24674/9/be/src/exprs/expr-value.h
File be/src/exprs/expr-value.h:

https://gerrit.cloudera.org/#/c/24674/9/be/src/exprs/expr-value.h@331
PS9, Line 331: DCHECK(false) << type.DebugString();
In a release build, this will jump to the next case and return &timestamp_val;
Can you add a return nullptr to avoid this?


https://gerrit.cloudera.org/#/c/24674/9/be/src/exprs/literal.cc
File be/src/exprs/literal.cc:

https://gerrit.cloudera.org/#/c/24674/9/be/src/exprs/literal.cc@474
PS9, Line 474: const_cast
To avoid const_cast, would it make sense to return a void* from 
ExprValue::GetRawValue instead?


https://gerrit.cloudera.org/#/c/24674/9/be/src/exprs/python-udf-call.h
File be/src/exprs/python-udf-call.h:

https://gerrit.cloudera.org/#/c/24674/9/be/src/exprs/python-udf-call.h@34
PS9, Line 34: is
nit: be


https://gerrit.cloudera.org/#/c/24674/9/be/src/exprs/python-udf-call.h@39
PS9, Line 39: the the
nit: the


https://gerrit.cloudera.org/#/c/24674/9/be/src/exprs/python-udf-call.h@40
PS9, Line 40: matches
nit: match


https://gerrit.cloudera.org/#/c/24674/9/be/src/exprs/python-udf-call.cc
File be/src/exprs/python-udf-call.cc:

https://gerrit.cloudera.org/#/c/24674/9/be/src/exprs/python-udf-call.cc@121
PS9, Line 121: friend
nit: Are these friend keyboards necessary? Since it's a struct, and ref_ is 
public.


https://gerrit.cloudera.org/#/c/24674/9/be/src/exprs/python-udf-call.cc@196
PS9, Line 196: StatusOr
Cannot a (pointer/reference to a) PyObjectRefStrong be passed as an argument 
while returning Status?
That way, StatusOr would not be necessary.


https://gerrit.cloudera.org/#/c/24674/9/be/src/exprs/python-udf-call.cc@203
PS9, Line 203:     if (!status.ok()) {
             :       return status;
             :     }
Doesn't the macro RETURN_IF_ERROR work here?


https://gerrit.cloudera.org/#/c/24674/9/be/src/exprs/python-udf-call.cc@214
PS9, Line 214: return Status("Failed to allocate Arrow C schema struct");
Not sure it matter since it's a failure path, but you leak arrow_c_array here. 
Same for all early exits later on.


https://gerrit.cloudera.org/#/c/24674/9/be/src/exprs/python-udf-call.cc@222
PS9, Line 222: arrow_c_array
Will it get eventually free-ed?


https://gerrit.cloudera.org/#/c/24674/9/be/src/exprs/python-udf-call.cc@264
PS9, Line 264: struct
nit: Is this necessary?


https://gerrit.cloudera.org/#/c/24674/9/be/src/exprs/python-udf-call.cc@270
PS9, Line 270:     return Status(
             :         "The length of the Arrow array returned by the Python 
UDF is unexpected");
You could add the length values to the error string.


https://gerrit.cloudera.org/#/c/24674/9/be/src/exprs/python-udf-call.cc@362
PS9, Line 362: new EvalState;
Where is this delete-ed?


https://gerrit.cloudera.org/#/c/24674/9/be/src/exprs/python-udf-call.cc@549
PS9, Line 549: PythonUdfCall
Can you add a longer error message here? Most codegen functions share a 
template for this.



--
To view, visit https://gerrit.cloudera.org/24674
To unsubscribe, visit https://gerrit.cloudera.org/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I04207ac53a53381b0dbdb9a7768665fb95aad519
Gerrit-Change-Number: 24674
Gerrit-PatchSet: 9
Gerrit-Owner: Xuebin Su <[email protected]>
Gerrit-Reviewer: Balazs Hevele <[email protected]>
Gerrit-Reviewer: Impala Public Jenkins <[email protected]>
Gerrit-Reviewer: Kurt Deschler <[email protected]>
Gerrit-Reviewer: Michael Smith <[email protected]>
Gerrit-Reviewer: Xuebin Su <[email protected]>
Gerrit-Comment-Date: Thu, 12 Nov 2026 14:59:10 +0000
Gerrit-HasComments: Yes

Reply via email to