github-actions[bot] commented on code in PR #70100:
URL: https://github.com/apache/doris/pull/70100#discussion_r4662971422


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/NullToNonNullFunction.java:
##########
@@ -51,7 +50,7 @@ public interface NullToNonNullFunction {
      */
     static boolean canConvertNullToNonNull(Expression e) {
         return e instanceof NullToNonNullFunction
-                || (e instanceof AlwaysNotNullable
+                || ((e instanceof AlwaysNotNullable || (e instanceof 
ScalarFunction && e instanceof Udf))

Review Comment:
   [P1] Cover builtins that consume NULL without propagating it
   
   The shared predicate still misses builtins such as `array_position`: its 
`nullable()` follows only the array argument, and it implements none of these 
markers. A constant array also has no input slots, so the recursive check does 
not catch it. This permits the reduced plan:
   
   ```text
   Local TopN(sort_key ASC NULLS LAST, r.k; LIMIT 1)
     Project(array_position([0,1], l.k) AS sort_key, r.k)
       RIGHT/FULL HASH JOIN(l.k = r.k)
         UnionAll(left k=0, delayed left k=1)
         right keys {0,1}
   ```
   
   `visitPhysicalProject` expands the alias, but `canPushToJoinLeft` accepts 
it. The first match produces `(sort_key=1,r.k=0)` and establishes bound 1; the 
scan filter removes late left key 1 because its array position is 2. The join 
then emits `(l.k=NULL,r.k=1)`. BE `FunctionArrayIndex<ArrayPositionAction>` 
returns 0 for a NULL search value absent from `[0,1]`, so the synthetic row 
becomes `(0,1)` and incorrectly wins. `NULLS LAST` cannot help because that 
result is non-NULL.
   
   This is a distinct builtin instance from the fixed UDF/UUID thread. 
`make_set(1,cast(l.k as string))` likewise returns an empty string for NULL and 
is unmarked. Extend the shared safety contract to these NULL-consuming 
functions and add RIGHT/FULL enabled/disabled regressions with a 
constant-container probe.



-- 
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]

Reply via email to