[fix](MySQL) the way Doris handles boolean type is consistent with MySQL (#19416)
This commit is contained in:
@ -422,6 +422,10 @@ public class BinaryPredicate extends Predicate implements Writable {
|
||||
&& (t2 == PrimitiveType.BIGINT || t2 == PrimitiveType.LARGEINT)) {
|
||||
return Type.LARGEINT;
|
||||
}
|
||||
// MySQL will try to parse string as bigint, if failed, will take string as 0.
|
||||
if (t1 == PrimitiveType.BIGINT && t2.isCharFamily()) {
|
||||
return Type.BIGINT;
|
||||
}
|
||||
|
||||
// Implicit conversion affects query performance.
|
||||
// For a common example datekey='20200825' which datekey is int type.
|
||||
|
||||
@ -227,7 +227,14 @@ public class StringLiteral extends LiteralExpr {
|
||||
throw new AnalysisException(e.getMessage());
|
||||
}
|
||||
}
|
||||
return new IntLiteral(value, targetType);
|
||||
// MySQL will try to parse string as bigint, if failed, will cast string as 0.
|
||||
long longValue;
|
||||
try {
|
||||
longValue = Long.parseLong(value);
|
||||
} catch (NumberFormatException e) {
|
||||
longValue = 0L;
|
||||
}
|
||||
return new IntLiteral(longValue, targetType);
|
||||
case LARGEINT:
|
||||
if (VariableVarConverters.hasConverter(beConverted)) {
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user