You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by "wuwenchi (via GitHub)" <gi...@apache.org> on 2023/08/10 02:26:01 UTC
[GitHub] [doris] wuwenchi commented on a diff in pull request #22740: [fix] fix iceberg's filter expr to filter file
wuwenchi commented on code in PR #22740:
URL: https://github.com/apache/doris/pull/22740#discussion_r1289456520
##########
fe/fe-core/src/main/java/org/apache/doris/external/iceberg/util/IcebergUtils.java:
##########
@@ -372,23 +375,23 @@ private static Object extractDorisLiteral(Expr expr) {
return boolLiteral.getValue();
} else if (expr instanceof DateLiteral) {
DateLiteral dateLiteral = (DateLiteral) expr;
- DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMddHHmmss")
- .withZone(ZoneId.systemDefault());
- StringBuilder sb = new StringBuilder();
- sb.append(dateLiteral.getYear())
- .append(dateLiteral.getMonth())
- .append(dateLiteral.getDay())
- .append(dateLiteral.getHour())
- .append(dateLiteral.getMinute())
- .append(dateLiteral.getSecond());
+
+ String formatDate = String.format("%04d%02d%02d%02d%02d%02d",
+ dateLiteral.getYear(),
+ dateLiteral.getMonth(),
+ dateLiteral.getDay(),
+ dateLiteral.getHour(),
+ dateLiteral.getMinute(),
+ dateLiteral.getSecond());
Date date;
try {
date = Date.from(
- LocalDateTime.parse(sb.toString(), formatter).atZone(ZoneId.systemDefault()).toInstant());
+ LocalDateTime.parse(formatDate, dateFormatter).atZone(ZoneId.systemDefault()).toInstant());
} catch (DateTimeParseException e) {
+ LOG.error("Failed to parse date from \"" + formatDate + "\".");
return null;
}
- return date.getTime();
+ return date.getTime() * MILLIS_TO_NANO_TIME;
Review Comment:
Fixed.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org