morrySnow commented on code in PR #67822:
URL: https://github.com/apache/doris/pull/67822#discussion_r4011958307


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/ArrayUnion.java:
##########
@@ -68,11 +69,18 @@ public ArrayUnion withChildren(List<Expression> children) {
 
     @Override
     public void checkLegalityBeforeTypeCoercion() {
-        DataType argType = getArgument(0).getDataType();
-        if (argType.isArrayType() && (((ArrayType) 
argType).getItemType().isComplexType()
-                    || ((ArrayType) argType).getItemType().isVariantType()
-                    || ((ArrayType) argType).getItemType().isJsonType())) {
-            throw new AnalysisException("array_union does not support types: " 
+ argType.toSql());
+        for (Expression child : getArguments()) {
+            DataType argType = child.getDataType();
+            if (argType == NullType.INSTANCE) {
+                continue;
+            }
+            if (!argType.isArrayType()) {
+                throw new AnalysisException("array_union requires ARRAY 
arguments, but got " + argType.toSql());
+            }
+            DataType itemType = ((ArrayType) argType).getItemType();
+            if (!itemType.canBeUsedInArraySetOperation()) {

Review Comment:
   Updated in 232facb87db following maintainer direction. Array element support 
is now intentionally a pre-coercion function contract: the affected functions 
validate their original argument types in checkLegalityBeforeTypeCoercion(), so 
mixed VARBINARY/STRING and TIME/STRING inputs are rejected based on the 
unsupported source type. The allowlists were moved out of DataType into 
ArrayFunctionTypeChecker under the function package and are grouped by set, 
equality/hash, comparison, and min/max implementations. Regression coverage now 
asserts that the mixed cases fail; FE build/checkstyle, the target UT, forced 
oracle generation, and the normal regression run all pass.



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