Skip to content

Commit c0c758d

Browse files
committed
fix timestamp type to use microseconds instead
1 parent 55b1e5b commit c0c758d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

spark/src/main/java/org/apache/iceberg/spark/source/StructInternalRow.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ public long getLong(int ordinal) {
138138
if (longVal instanceof Long) {
139139
return (long) longVal;
140140
} else if (longVal instanceof OffsetDateTime) {
141-
return TimeUnit.SECONDS.toDays(((OffsetDateTime) longVal).toEpochSecond());
141+
return Duration.between(Instant.EPOCH, (OffsetDateTime) longVal).toNanos() / 1000;
142142
} else if (longVal instanceof LocalDate) {
143143
return ((LocalDate) longVal).toEpochDay();
144144
} else {

0 commit comments

Comments
 (0)