You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by "morrySnow (via GitHub)" <gi...@apache.org> on 2023/06/15 02:29:35 UTC

[GitHub] [doris] morrySnow commented on a diff in pull request #20599: [Fix](Planner) Add tinyint result support in where, having and on clause

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


##########
fe/fe-core/src/main/java/org/apache/doris/analysis/SelectStmt.java:
##########
@@ -1263,6 +1269,9 @@ private void analyzeAggregation(Analyzer analyzer) throws AnalysisException {
                 havingClauseAfterAnaylzed = havingClause.substitute(aliasSMap, analyzer, false);
             }
             havingClauseAfterAnaylzed = rewriteQueryExprByMvColumnExpr(havingClauseAfterAnaylzed, analyzer);
+            if (havingClauseAfterAnaylzed.getType().isTinyint()) {

Review Comment:
   i think it should be `!isBoolean()`



##########
fe/fe-core/src/main/java/org/apache/doris/analysis/SelectStmt.java:
##########
@@ -851,6 +852,11 @@ private void whereClauseRewrite() {
             } else {
                 whereClause = new BoolLiteral(true);
             }
+        } else if (whereClause instanceof CaseExpr
+                && (((CaseExpr) whereClause).getChild(1) instanceof IntLiteral)
+                && (((CaseExpr) whereClause).getChild(2) instanceof IntLiteral)) {
+            whereClause = new CastExpr(TypeDef.create(PrimitiveType.BOOLEAN), whereClause);
+            whereClause.setType(Type.BOOLEAN);

Review Comment:
   all whereClause should boolean type, so do not only process case when



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