Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
zclllyybb committed Jul 14, 2024
1 parent dc5b7e6 commit 653aba3
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ private static LocalDateTime getDateCeilOrFloor(DATE tag, LocalDateTime date, in
+ (dt.getHour() - start.getHour()) * 60 * 60
+ (dt.getMinute() - start.getMinute()) * 60
+ (dt.getSecond() - start.getSecond());
trivialPart = 0;
trivialPart = dt.getMicroSecond() - start.getMicroSecond();
break;
}
default: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ public DateTimeV2Literal roundFloor(int newScale) {
}

public static Expression fromJavaDateType(LocalDateTime dateTime) {
return fromJavaDateType(dateTime, 0);
return fromJavaDateType(dateTime, 6);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,14 +183,10 @@ void testFoldString() {
executor = new ExpressionRuleExecutor(ImmutableList.of(
bottomUp(FoldConstantRuleOnFE.VISITOR_INSTANCE)
));
ConvertTz c = new ConvertTz(DateTimeV2Literal.fromJavaDateType(LocalDateTime.of(1, 1, 1, 1, 1, 1)),
StringLiteral.of("Asia/Shanghai"), StringLiteral.of("GMT"));
Expression rewritten = executor.rewrite(c, context);
Assertions.assertEquals(new DateTimeV2Literal("0000-12-31 16:55:18"), rewritten);

DateFormat d = new DateFormat(DateTimeLiteral.fromJavaDateType(LocalDateTime.of(1, 1, 1, 1, 1, 1)),
StringLiteral.of("%y %m %d"));
rewritten = executor.rewrite(d, context);
Expression rewritten = executor.rewrite(d, context);
Assertions.assertEquals(new VarcharLiteral("01 01 01"), rewritten);
d = new DateFormat(DateTimeV2Literal.fromJavaDateType(LocalDateTime.of(1, 1, 1, 1, 1, 1)),
StringLiteral.of("%y %m %d"));
Expand Down

0 comments on commit 653aba3

Please sign in to comment.