Skip to content

Commit

Permalink
[Fix](Planner) fix case function with null cast to array null
Browse files Browse the repository at this point in the history
  • Loading branch information
LiBinfeng-01 committed Aug 16, 2023
1 parent d371101 commit 5b2cdc4
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ public void analyze() throws AnalysisException {
// 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 (childType.isNull() || !Type.canCastTo(childType, type)) {
if (!Type.canCastTo(childType, type)) {
throw new AnalysisException("Invalid type cast of " + getChild(0).toSql()
+ " from " + childType + " to " + type);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,6 @@
-- !sql_case2 --
-2

-- !sql_case3 --
0

Original file line number Diff line number Diff line change
Expand Up @@ -228,4 +228,8 @@ suite("test_case_function_null", "query,p0") {
END)
FROM case_null2;
"""
}


qt_sql_case3 """SELECT COUNT(CASE (NOT (NOT true)) WHEN (((- 47960023)) IS NOT NULL) THEN NULL ELSE NULL END) from case_null1;"""

}

0 comments on commit 5b2cdc4

Please sign in to comment.