You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by yi...@apache.org on 2022/06/10 07:03:14 UTC
[incubator-doris] branch master updated: [fix](fe) select stmt will make BE coredump when its castExpr is like cast(int as array<>) (#9995)
This is an automated email from the ASF dual-hosted git repository.
yiguolei pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-doris.git
The following commit(s) were added to refs/heads/master by this push:
new 4135e59f77 [fix](fe) select stmt will make BE coredump when its castExpr is like cast(int as array<>) (#9995)
4135e59f77 is described below
commit 4135e59f77c1aa5a99c84ebc4175dc3c77b58bbd
Author: yinzhijian <37...@qq.com>
AuthorDate: Fri Jun 10 15:03:09 2022 +0800
[fix](fe) select stmt will make BE coredump when its castExpr is like cast(int as array<>) (#9995)
* [fix](fe) select stmt will make BE coredump when its castExpr is like cast(int as array<>)
* fix implicit cast scalar type bug
* Revert "fix implicit cast scalar type bug"
This reverts commit 1f05b6bab72430214dca88f386b50ef9a081e60a.
* only check array cast, retrigger
---
fe/fe-core/src/main/java/org/apache/doris/analysis/CastExpr.java | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/fe/fe-core/src/main/java/org/apache/doris/analysis/CastExpr.java b/fe/fe-core/src/main/java/org/apache/doris/analysis/CastExpr.java
index 10cd2d065c..f5dd01c112 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/CastExpr.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/CastExpr.java
@@ -265,6 +265,15 @@ public class CastExpr extends Expr {
noOp = true;
return;
}
+ // select stmt will make BE coredump when its castExpr is like cast(int as array<>),
+ // it is necessary to check if it is castable before creating fn.
+ // char type will fail in canCastTo, so for compatibility, only the cast of array type is checked here.
+ if (type.isArrayType() || childType.isArrayType()) {
+ if (!Type.canCastTo(childType, type)) {
+ throw new AnalysisException("Invalid type cast of " + getChild(0).toSql()
+ + " from " + childType + " to " + type);
+ }
+ }
this.opcode = TExprOpcode.CAST;
FunctionName fnName = new FunctionName(getFnName(type));
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org