[FIX](array)fix if function for array() #22553
[FIX](array)fix if function for array() #22553
This commit is contained in:
@ -1707,6 +1707,9 @@ public class FunctionCallExpr extends Expr {
|
||||
&& args[ix].isDecimalV3OrContainsDecimalV3())) {
|
||||
// Do not do this cast if types are both decimalv3 with different precision/scale.
|
||||
uncheckedCastChild(args[ix], i);
|
||||
} else if (fnName.getFunction().equalsIgnoreCase("if")
|
||||
&& argTypes[i].isArrayType() && ((ArrayType) argTypes[i]).getItemType().isNull()) {
|
||||
uncheckedCastChild(args[ix], i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,13 @@
|
||||
-- This file is automatically generated. You should know what you did if you want to edit this
|
||||
-- !select --
|
||||
\N
|
||||
|
||||
-- !select --
|
||||
["1970-01-01", "1970-01-01"]
|
||||
|
||||
-- !select --
|
||||
["1970-01-01", "1970-01-01"]
|
||||
|
||||
-- !select --
|
||||
[]
|
||||
|
||||
@ -16,5 +16,9 @@
|
||||
// under the License.
|
||||
|
||||
suite("test_if") {
|
||||
sql "select if(id=1,count,hll_empty()) from (select 1 as id, hll_hash(1) as count) t"
|
||||
qt_select "select if(id=1,count,hll_empty()) from (select 1 as id, hll_hash(1) as count) t"
|
||||
|
||||
qt_select "select if(job_d is null, array(), job_d) as test from (select array('1970-01-01', '1970-01-01') as job_d) t"
|
||||
qt_select "select if(job_d is null, array('1970-01-01'), job_d) as test from (select array('1970-01-01', '1970-01-01') as job_d) t"
|
||||
qt_select "select if(job_d is null, job_d, array()) as test from (select array('1970-01-01', '1970-01-01') as job_d) t"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user