This is an automated email from the ASF dual-hosted git repository.
ahmedabualsaud pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/beam.git
The following commit(s) were added to refs/heads/master by this push:
new de918a653f2 fix(iceberg): Incorrect $partition Metadata in Trino for
Iceberg Tables Written via IcebergIO.writeRows with Timestamp Partitioning
(#36562)
de918a653f2 is described below
commit de918a653f258c35c8ff5f4dcb91386b4781cab7
Author: Mehdi.D <[email protected]>
AuthorDate: Thu Nov 13 11:50:36 2025 +0100
fix(iceberg): Incorrect $partition Metadata in Trino for Iceberg Tables
Written via IcebergIO.writeRows with Timestamp Partitioning (#36562)
* fix(iceberg): update month calculation to use ChronoUnit for improved
accuracy
* fix(tests): update trigger file comment and modification count for IO
Iceberg Integration Tests
* Update IO_Iceberg_Integration_Tests.json
---------
Co-authored-by: Mehdi DARDANI <[email protected]>
Co-authored-by: Ahmed Abualsaud
<[email protected]>
---
.github/trigger_files/IO_Iceberg_Integration_Tests.json | 2 +-
.../java/org/apache/beam/sdk/io/iceberg/RecordWriterManager.java | 5 +++--
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/.github/trigger_files/IO_Iceberg_Integration_Tests.json
b/.github/trigger_files/IO_Iceberg_Integration_Tests.json
index 37dd25bf902..34a6e02150e 100644
--- a/.github/trigger_files/IO_Iceberg_Integration_Tests.json
+++ b/.github/trigger_files/IO_Iceberg_Integration_Tests.json
@@ -1,4 +1,4 @@
{
"comment": "Modify this file in a trivial way to cause this test suite to
run.",
- "modification": 3
+ "modification": 4
}
diff --git
a/sdks/java/io/iceberg/src/main/java/org/apache/beam/sdk/io/iceberg/RecordWriterManager.java
b/sdks/java/io/iceberg/src/main/java/org/apache/beam/sdk/io/iceberg/RecordWriterManager.java
index b1e8a825601..6ddd943eb19 100644
---
a/sdks/java/io/iceberg/src/main/java/org/apache/beam/sdk/io/iceberg/RecordWriterManager.java
+++
b/sdks/java/io/iceberg/src/main/java/org/apache/beam/sdk/io/iceberg/RecordWriterManager.java
@@ -228,8 +228,9 @@ class RecordWriterManager implements AutoCloseable {
String transformName =
Preconditions.checkArgumentNotNull(partitionFieldMap.get(name)).transform().toString();
if (Transforms.month().toString().equals(transformName)) {
- int month = YearMonth.parse(value).getMonthValue();
- value = String.valueOf(month);
+ long months =
+ ChronoUnit.MONTHS.between(EPOCH,
YearMonth.parse(value).atDay(1).atStartOfDay());
+ value = String.valueOf(months);
} else if (Transforms.hour().toString().equals(transformName)) {
long hour = ChronoUnit.HOURS.between(EPOCH, LocalDateTime.parse(value,
HOUR_FORMATTER));
value = String.valueOf(hour);