github-actions[bot] commented on code in PR #64563:
URL: https://github.com/apache/doris/pull/64563#discussion_r3457616503
##########
be/src/exprs/lambda_function/varray_sort_function.cpp:
##########
@@ -221,6 +250,60 @@ class ArraySortFunction : public LambdaFunction {
return Status::OK();
}
+private:
+ Status _set_comparator_argument_gap(const VExprSPtr& expr,
+ const std::vector<std::string>*
argument_names) const {
+ if (expr->is_column_ref()) {
+ auto* ref = static_cast<VColumnRef*>(expr.get());
+ RETURN_IF_ERROR(_validate_comparator_argument_ref(*ref,
argument_names));
+ ref->set_gap(0);
+ return Status::OK();
+ }
+
+ if (expr->is_slot_ref() || expr->is_virtual_slot_ref()) {
Review Comment:
This skips the nested lambda body, but the comparator frame installed during
execution has `bind_by_name = false`, `parent_bindings_visible = false`, and no
argument bindings. For a valid lexical shape such as `array_sort((x, y) ->
array_map(z -> z + x, [1, 2]), arr)`, the `x` captured by the nested
`array_map` is not processed by this walker. At execution the inner `array_map`
pushes a named `z` frame; `VColumnRef("x")` searches that frame, then hits the
anonymous comparator frame and stops, so `_get_column_position()` returns `-1`
instead of resolving the comparator's current `x`. That turns a capture of the
comparator's own argument into an internal "input block not contain column ref"
error. Please either make comparator arguments available to nested lambda
frames without breaking the direct x/y ordinal handling, or reject this
nested-capture shape during prepare.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]