You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by GitBox <gi...@apache.org> on 2022/07/18 13:30:04 UTC

[GitHub] [doris] cambyzju commented on a diff in pull request #10980: [Bug][Array] cast array element to same type

cambyzju commented on code in PR #10980:
URL: https://github.com/apache/doris/pull/10980#discussion_r923375078


##########
fe/fe-core/src/main/java/org/apache/doris/analysis/ArrayLiteral.java:
##########
@@ -39,20 +38,28 @@ public ArrayLiteral() {
         children = new ArrayList<>();
     }
 
-    public ArrayLiteral(LiteralExpr... v) {
+    public ArrayLiteral(LiteralExpr... exprs) throws AnalysisException {
         Type itemType = Type.NULL;
         boolean containsNull = false;
-        for (LiteralExpr expr : v) {
-            if (itemType == Type.NULL || expr.type.getSlotSize() > itemType.getSlotSize()) {
-                itemType = expr.type;
+        for (LiteralExpr expr : exprs) {
+            if (itemType == Type.NULL || expr.getType().getSlotSize() > itemType.getSlotSize()) {

Review Comment:
   use `getAssignmentCompatibleType` is better than use `getSlotSize`



-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org