This is an automated email from the ASF dual-hosted git repository.
lide pushed a commit to branch branch-2.0
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-2.0 by this push:
new 1e9be3d771d [fix](iceberg) fix error when query iceberg table using
date cast predicate (#32211)
1e9be3d771d is described below
commit 1e9be3d771da7714a8a987b15b688d2bf1af111f
Author: Yulei-Yang <[email protected]>
AuthorDate: Thu Mar 14 13:29:33 2024 +0800
[fix](iceberg) fix error when query iceberg table using date cast predicate
(#32211)
---
fe/fe-core/src/main/java/org/apache/doris/analysis/DateLiteral.java | 4 ++++
.../java/org/apache/doris/external/iceberg/util/IcebergUtils.java | 2 +-
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/analysis/DateLiteral.java
b/fe/fe-core/src/main/java/org/apache/doris/analysis/DateLiteral.java
index 36691a1e1e3..9f05c0e6574 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/DateLiteral.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/DateLiteral.java
@@ -619,6 +619,10 @@ public class DateLiteral extends LiteralExpr {
return this.type.isDate() || this.type.isDateV2();
}
+ public boolean isDateTimeType() {
+ return this.type.isDatetime() || this.type.isDatetimeV2();
+ }
+
@Override
public String getStringValue() {
char[] dateTimeChars = new char[26]; // Enough to hold "YYYY-MM-DD
HH:MM:SS.mmmmmm"
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/external/iceberg/util/IcebergUtils.java
b/fe/fe-core/src/main/java/org/apache/doris/external/iceberg/util/IcebergUtils.java
index 119a0b30fb6..47fd76c7878 100644
---
a/fe/fe-core/src/main/java/org/apache/doris/external/iceberg/util/IcebergUtils.java
+++
b/fe/fe-core/src/main/java/org/apache/doris/external/iceberg/util/IcebergUtils.java
@@ -376,7 +376,7 @@ public class IcebergUtils {
return boolLiteral.getValue();
} else if (expr instanceof DateLiteral) {
DateLiteral dateLiteral = (DateLiteral) expr;
- if (dateLiteral.isDateType()) {
+ if (dateLiteral.isDateType() || dateLiteral.isDateTimeType()) {
return dateLiteral.getStringValue();
} else {
return dateLiteral.unixTimestamp(TimeUtils.getTimeZone()) *
MILLIS_TO_NANO_TIME;
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]