[fix](Nereids) datetimev2 literal equals should compare microsecond (#40121) (#40150)

pick from master #40121
This commit is contained in:
morrySnow
2024-08-29 23:41:51 +08:00
committed by GitHub
parent fe881f8676
commit 82fb747e6f
2 changed files with 16 additions and 1 deletions

View File

@ -104,6 +104,11 @@ public class DateTimeV2Literal extends DateTimeLiteral {
getDataType().toCatalogDataType());
}
@Override
public double getDouble() {
return super.getDouble() + microSecond / 1000000.0;
}
@Override
public String toString() {
return getStringValue();
@ -291,6 +296,6 @@ public class DateTimeV2Literal extends DateTimeLiteral {
return false;
}
DateTimeV2Literal literal = (DateTimeV2Literal) o;
return Objects.equals(dataType, literal.dataType);
return Objects.equals(dataType, literal.dataType) && Objects.equals(microSecond, literal.microSecond);
}
}