Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Fix](Planner) fix arguments type changed to array type and implicitly cast child error #22947

Merged
merged 1 commit into from
Aug 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -23,3 +23,6 @@
-- !sql8 --
\N

-- !sql9 --
\N

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

}
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,7 @@ suite("test_cast_array_functions_by_literal") {
// empty string is invalid array, return NULL
qt_sql8 """select cast('' as array<string>)"""

test {
sql "select cast(NULL as array<int>)"
// check exception message contains
exception "errCode = 2,"
}
qt_sql9 """select cast(NULL as array<int>)"""

test {
sql "select cast(1 as array<int>)"
Expand Down
Loading