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


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/parser/LogicalPlanBuilder.java:
##########
@@ -3800,12 +3801,30 @@ private List<Literal> typeCoercionItems(List<Literal> 
items) {
     }
 
     @Override
-    public ArrayLiteral visitArrayLiteral(ArrayLiteralContext ctx) {
-        List<Literal> items = 
ctx.items.stream().<Literal>map(this::typedVisit).collect(Collectors.toList());
+    public Expression visitArrayLiteral(ArrayLiteralContext ctx) {
+        List<Expression> items = 
ctx.items.stream().<Expression>map(this::typedVisit).collect(Collectors.toList());
         if (items.isEmpty()) {
-            return new ArrayLiteral(items);
+            return new ArrayLiteral(ImmutableList.of());
+        }
+        for (Expression item : items) {
+            if (!item.isConstant()) {

Review Comment:
   [P1] Validate array-item constantness after function binding
   
   At this point ordinary calls are still `UnboundFunction`, which defaults to 
deterministic and is neither an `AggregateFunction` nor a 
`TableGeneratingFunction`. As a result, `[random()]` and `[sum(1)]` pass this 
guard; binding later turns them into a volatile function and an aggregate, but 
line 3820 has already lowered the bracket expression to a normal scalar `Array` 
and no bracket-specific check runs again. This lets constant-only syntax vary 
per row or depend on group cardinality. Please preserve the bracket-array 
origin through analysis and validate the bound items before lowering, with 
analyzed negative tests for these late-bound cases.



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