[FIX](complextype)fix count func with complex type (#28873)
This commit is contained in:
@ -1648,8 +1648,25 @@ public class FunctionCallExpr extends Expr {
|
||||
// now first find function in built-in functions
|
||||
if (Strings.isNullOrEmpty(fnName.getDb())) {
|
||||
Type[] childTypes = collectChildReturnTypes();
|
||||
fn = getBuiltinFunction(fnName.getFunction(), childTypes,
|
||||
Function.CompareMode.IS_NONSTRICT_SUPERTYPE_OF);
|
||||
// when we call count<Array<T>> with nested type is not null type which is defined in FunctionSet
|
||||
// so here aim to make function signature to match builtln func we defined in fe code
|
||||
if (fnName.getFunction().equalsIgnoreCase("count") && childTypes.length > 0
|
||||
&& childTypes[0].isComplexType()) {
|
||||
// get origin type to match builtln func
|
||||
Type[] matchFuncChildTypes = new Type[1];
|
||||
if (childTypes[0].isArrayType()) {
|
||||
matchFuncChildTypes[0] = Type.ARRAY;
|
||||
} else if (childTypes[0].isMapType()) {
|
||||
matchFuncChildTypes[0] = Type.MAP;
|
||||
} else if (childTypes[0].isStructType()) {
|
||||
matchFuncChildTypes[0] = Type.GENERIC_STRUCT;
|
||||
}
|
||||
fn = getBuiltinFunction(fnName.getFunction(), matchFuncChildTypes,
|
||||
Function.CompareMode.IS_NONSTRICT_SUPERTYPE_OF);
|
||||
} else {
|
||||
fn = getBuiltinFunction(fnName.getFunction(), childTypes,
|
||||
Function.CompareMode.IS_NONSTRICT_SUPERTYPE_OF);
|
||||
}
|
||||
}
|
||||
|
||||
// find user defined functions
|
||||
@ -1888,6 +1905,10 @@ public class FunctionCallExpr extends Expr {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (fnName.getFunction().equalsIgnoreCase("count") && args[i].isComplexType()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((fnName.getFunction().equalsIgnoreCase("money_format") || fnName.getFunction()
|
||||
.equalsIgnoreCase("histogram")
|
||||
|| fnName.getFunction().equalsIgnoreCase("hist"))
|
||||
|
||||
Reference in New Issue
Block a user