[fix](planner)cast floating point type to bigint for bit functions (#26598)
This commit is contained in:
@ -1592,6 +1592,27 @@ public class FunctionCallExpr extends Expr {
|
||||
args[0] = Type.DOUBLE;
|
||||
System.arraycopy(childrenTypes, 1, args, 1, childrenTypes.length - 1);
|
||||
fn = getBuiltinFunction(fnName.getFunction(), args, Function.CompareMode.IS_NONSTRICT_SUPERTYPE_OF);
|
||||
} else if (fnName.getFunction().equalsIgnoreCase("bitand")
|
||||
|| fnName.getFunction().equalsIgnoreCase("bitor")
|
||||
|| fnName.getFunction().equalsIgnoreCase("bitxor")) {
|
||||
Type[] childTypes = collectChildReturnTypes();
|
||||
if (Arrays.stream(childTypes).anyMatch(child -> child.isDecimalV2()
|
||||
|| child.isDecimalV3() || child.isFloatingPointType())) {
|
||||
uncheckedCastChild(Type.BIGINT, 0);
|
||||
uncheckedCastChild(Type.BIGINT, 1);
|
||||
argTypes[0] = Type.BIGINT;
|
||||
argTypes[1] = Type.BIGINT;
|
||||
}
|
||||
fn = getBuiltinFunction(fnName.getFunction(), argTypes,
|
||||
Function.CompareMode.IS_NONSTRICT_SUPERTYPE_OF);
|
||||
} else if (fnName.getFunction().equalsIgnoreCase("bitnot")) {
|
||||
if (children.get(0).type.isDecimalV2() || children.get(0).type.isDecimalV3()
|
||||
|| children.get(0).type.isFloatingPointType()) {
|
||||
uncheckedCastChild(Type.BIGINT, 0);
|
||||
argTypes[0] = Type.BIGINT;
|
||||
}
|
||||
fn = getBuiltinFunction(fnName.getFunction(), argTypes,
|
||||
Function.CompareMode.IS_NONSTRICT_SUPERTYPE_OF);
|
||||
} else {
|
||||
// now first find table function in table function sets
|
||||
if (isTableFnCall) {
|
||||
|
||||
Reference in New Issue
Block a user