Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,11 @@ public LiteralExpr toLegacyLiteral() {
getDataType().toCatalogDataType());
}

@Override
public double getDouble() {
return super.getDouble() + microSecond / 1000000.0;
}

@Override
public String toString() {
return getStringValue();
Expand Down Expand Up @@ -291,6 +296,6 @@ public boolean equals(Object o) {
return false;
}
DateTimeV2Literal literal = (DateTimeV2Literal) o;
return Objects.equals(dataType, literal.dataType);
return Objects.equals(dataType, literal.dataType) && Objects.equals(microSecond, literal.microSecond);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -490,4 +490,14 @@ void testRoundCeiling() {
Assertions.assertEquals(1, literal.roundCeiling(0).month);
Assertions.assertEquals(2001, literal.roundCeiling(0).year);
}

@Test
void testEquals() {
DateTimeV2Literal l1 = new DateTimeV2Literal(1, 1, 1, 1, 1, 1, 1);
DateTimeV2Literal l2 = new DateTimeV2Literal(1, 1, 1, 1, 1, 1, 1);
DateTimeV2Literal l3 = new DateTimeV2Literal(1, 1, 1, 1, 1, 1, 2);

Assertions.assertEquals(l1, l2);
Assertions.assertNotEquals(l1, l3);
}
}