[fix](nereids)decimal and datetime literal comparison should compare datatype too (#36064)
pick from master #36055
This commit is contained in:
@ -29,6 +29,7 @@ import org.apache.doris.nereids.util.StandardDateFormat;
|
||||
import com.google.common.base.Preconditions;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* date time v2 literal for nereids
|
||||
@ -271,4 +272,19 @@ public class DateTimeV2Literal extends DateTimeLiteral {
|
||||
dateTime.getMinute(), dateTime.getSecond(),
|
||||
(dateTime.getNano() / 1000) / value * value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
if (!super.equals(o)) {
|
||||
return false;
|
||||
}
|
||||
DateTimeV2Literal literal = (DateTimeV2Literal) o;
|
||||
return Objects.equals(dataType, literal.dataType);
|
||||
}
|
||||
}
|
||||
|
||||
@ -95,4 +95,19 @@ public class DecimalLiteral extends FractionalLiteral {
|
||||
precision, scale, realPrecision, realScale));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
if (!super.equals(o)) {
|
||||
return false;
|
||||
}
|
||||
DecimalLiteral literal = (DecimalLiteral) o;
|
||||
return Objects.equals(dataType, literal.dataType);
|
||||
}
|
||||
}
|
||||
|
||||
@ -106,4 +106,19 @@ public class DecimalV3Literal extends FractionalLiteral {
|
||||
precision, scale, realPrecision, realScale));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
if (!super.equals(o)) {
|
||||
return false;
|
||||
}
|
||||
DecimalV3Literal literal = (DecimalV3Literal) o;
|
||||
return Objects.equals(dataType, literal.dataType);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user