This is an automated email from the ASF dual-hosted git repository.
pvary pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/iceberg.git
The following commit(s) were added to refs/heads/main by this push:
new 153237b568 Flink: Backport add Nanosecond Precision Support for
Flink-Iceberg Integration to Flink 2.0 - missing changes (#16239)
153237b568 is described below
commit 153237b568d6c1ddb6025a58c551e8e459164c71
Author: pvary <[email protected]>
AuthorDate: Thu May 7 13:30:23 2026 +0200
Flink: Backport add Nanosecond Precision Support for Flink-Iceberg
Integration to Flink 2.0 - missing changes (#16239)
---
.../org/apache/iceberg/flink/data/StructRowData.java | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git
a/flink/v2.0/flink/src/main/java/org/apache/iceberg/flink/data/StructRowData.java
b/flink/v2.0/flink/src/main/java/org/apache/iceberg/flink/data/StructRowData.java
index f2a20be331..b469f2310f 100644
---
a/flink/v2.0/flink/src/main/java/org/apache/iceberg/flink/data/StructRowData.java
+++
b/flink/v2.0/flink/src/main/java/org/apache/iceberg/flink/data/StructRowData.java
@@ -121,8 +121,8 @@ public class StructRowData implements RowData {
if (integer instanceof Integer) {
return (int) integer;
- } else if (integer instanceof LocalDate) {
- return (int) ((LocalDate) integer).toEpochDay();
+ } else if (integer instanceof LocalDate localDate) {
+ return (int) localDate.toEpochDay();
} else if (integer instanceof LocalTime) {
return (int) (((LocalTime) integer).toNanoOfDay() / 1000_000);
} else {
@@ -278,10 +278,10 @@ public class StructRowData implements RowData {
return value;
case TIMESTAMP:
long timeMillis;
- if (value instanceof LocalDateTime) {
- timeMillis = DateTimeUtil.microsFromTimestamp((LocalDateTime) value)
/ 1000L;
- } else if (value instanceof OffsetDateTime) {
- timeMillis = DateTimeUtil.microsFromTimestamptz((OffsetDateTime)
value) / 1000L;
+ if (value instanceof LocalDateTime localDateTime) {
+ timeMillis = DateTimeUtil.microsFromTimestamp(localDateTime) / 1000L;
+ } else if (value instanceof OffsetDateTime offsetDateTime) {
+ timeMillis = DateTimeUtil.microsFromTimestamptz(offsetDateTime) /
1000L;
} else {
timeMillis = Math.floorDiv((Long) value, 1000L);
}
@@ -291,10 +291,10 @@ public class StructRowData implements RowData {
* 1000);
case TIMESTAMP_NANO:
long nanoLong;
- if (value instanceof LocalDateTime) {
- nanoLong = DateTimeUtil.nanosFromTimestamp((LocalDateTime) value);
- } else if (value instanceof OffsetDateTime) {
- nanoLong = DateTimeUtil.nanosFromTimestamptz((OffsetDateTime) value);
+ if (value instanceof LocalDateTime localDateTime) {
+ nanoLong = DateTimeUtil.nanosFromTimestamp(localDateTime);
+ } else if (value instanceof OffsetDateTime offsetDateTime) {
+ nanoLong = DateTimeUtil.nanosFromTimestamptz(offsetDateTime);
} else {
nanoLong = (Long) value;
}