[fix](nereids) cast left child of TimestampArithmetic to wrong type in BindFunction (#12423)
This commit is contained in:
@ -175,7 +175,7 @@ public class BindFunction implements AnalysisRuleFactory {
|
||||
} catch (Exception e) {
|
||||
// ignore
|
||||
}
|
||||
if (!left.getDataType().isDateType() && arithmetic.getTimeUnit().isDateTimeUnit()) {
|
||||
if (!left.getDataType().isDateType() && !arithmetic.getTimeUnit().isDateTimeUnit()) {
|
||||
left = arithmetic.left().castTo(DateType.INSTANCE);
|
||||
}
|
||||
}
|
||||
|
||||
@ -36,6 +36,7 @@ import java.util.List;
|
||||
* Describes the addition and subtraction of time units from timestamps.
|
||||
* Arithmetic expressions on timestamps are syntactic sugar.
|
||||
* They are executed as function call exprs in the BE.
|
||||
* Example: '1996-01-01' + INTERVAL '3' month;
|
||||
* TODO: we need to rethink this, and maybe need to add a new type of Interval then implement IntervalLiteral as others
|
||||
*/
|
||||
public class TimestampArithmetic extends Expression implements BinaryExpression {
|
||||
|
||||
Reference in New Issue
Block a user