You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by "aIbrahiim (via GitHub)" <gi...@apache.org> on 2026/08/03 14:32:38 UTC
[PR] add Timestamp.MICROS for iceberg timestamptz [beam]
aIbrahiim opened a new pull request, #39592:
URL: https://github.com/apache/beam/pull/39592
**Please** add a meaningful description for your change here
------------------------
Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:
- [ ] Mention the appropriate issue in your description (for example: `addresses #123`), if applicable. This will automatically add a link to the pull request in the issue. If you would like the issue to automatically close on merging the pull request, comment `fixes #<ISSUE NUMBER>` instead.
- [ ] Update `CHANGES.md` with noteworthy changes.
- [ ] If this contribution is large, please file an Apache [Individual Contributor License Agreement](https://www.apache.org/licenses/icla.pdf).
See the [Contributor Guide](https://beam.apache.org/contribute) for more tips on [how to make review process smoother](https://github.com/apache/beam/blob/master/CONTRIBUTING.md#make-the-reviewers-job-easier).
To check the build health, please visit [https://github.com/apache/beam/blob/master/.test-infra/BUILD_STATUS.md](https://github.com/apache/beam/blob/master/.test-infra/BUILD_STATUS.md)
GitHub Actions Tests Status (on master branch)
------------------------------------------------------------------------------------------------
[](https://github.com/apache/beam/actions?query=workflow%3A%22Build+python+source+distribution+and+wheels%22+branch%3Amaster+event%3Aschedule)
[](https://github.com/apache/beam/actions?query=workflow%3A%22Python+Tests%22+branch%3Amaster+event%3Aschedule)
[](https://github.com/apache/beam/actions?query=workflow%3A%22Java+Tests%22+branch%3Amaster+event%3Aschedule)
[](https://github.com/apache/beam/actions?query=workflow%3A%22Go+tests%22+branch%3Amaster+event%3Aschedule)
See [CI.md](https://github.com/apache/beam/blob/master/CI.md) for more information about GitHub Actions CI or the [workflows README](https://github.com/apache/beam/blob/master/.github/workflows/README.md) to see a list of phrases to trigger workflows.
--
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: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] add Timestamp.MICROS for iceberg timestamptz [beam]
Posted by "gemini-code-assist[bot] (via GitHub)" <gi...@apache.org>.
gemini-code-assist[bot] commented on PR #39592:
URL: https://github.com/apache/beam/pull/39592#issuecomment-5167724666
> [!CAUTION]
> The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased.
--
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: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] add Timestamp.MICROS for iceberg timestamptz [beam]
Posted by "gemini-code-assist[bot] (via GitHub)" <gi...@apache.org>.
gemini-code-assist[bot] commented on PR #39592:
URL: https://github.com/apache/beam/pull/39592#issuecomment-5170738830
> [!CAUTION]
> The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased.
--
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: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] add Timestamp.MICROS for iceberg timestamptz [beam]
Posted by "ahmedabu98 (via GitHub)" <gi...@apache.org>.
ahmedabu98 commented on code in PR #39592:
URL: https://github.com/apache/beam/pull/39592#discussion_r3708113646
##########
sdks/java/extensions/sql/iceberg/src/test/java/org/apache/beam/sdk/extensions/sql/meta/provider/iceberg/IcebergReadWriteIT.java:
##########
@@ -200,8 +201,10 @@ public void runSqlWriteAndRead(boolean withPartitionFields)
assertEquals("my_catalog." + tableIdentifier, icebergTable.name());
assertTrue(icebergTable.location().startsWith(warehouse));
assertEquals(expectedSpec, icebergTable.spec());
- Schema expectedSchema = checkStateNotNull(metastore.getTable(tableName)).getSchema();
- assertEquals(expectedSchema, IcebergUtils.icebergSchemaToBeamSchema(icebergTable.schema()));
+ Schema fromIceberg = IcebergUtils.icebergSchemaToBeamSchema(icebergTable.schema());
+ assertEquals(
+ FieldType.logicalType(Timestamp.MICROS).withNullable(true),
+ fromIceberg.getField("c_timestamp").getType());
Review Comment:
I would remove the assertion here because it's misleading. The original assertion was intended to check the SQL table's schema
##########
sdks/java/extensions/sql/src/main/java/org/apache/beam/sdk/extensions/sql/impl/rel/BeamCalcRel.java:
##########
@@ -439,6 +439,12 @@ static Object toBeamObject(Object value, FieldType fieldType, boolean verifyValu
LocalDate.ofEpochDay(((Number) value).longValue() / MILLIS_PER_DAY),
LocalTime.ofNanoOfDay(
(((Number) value).longValue() % MILLIS_PER_DAY) * NANOS_PER_MILLISECOND));
+ } else if (org.apache.beam.sdk.schemas.logicaltypes.Timestamp.IDENTIFIER.equals(
Review Comment:
Can we add some unit tests (non-iceberg) to validate the additions in this file?
--
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: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] add Timestamp.MICROS for iceberg timestamptz [beam]
Posted by "ahmedabu98 (via GitHub)" <gi...@apache.org>.
ahmedabu98 merged PR #39592:
URL: https://github.com/apache/beam/pull/39592
--
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: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] add Timestamp.MICROS for iceberg timestamptz [beam]
Posted by "bvolpato (via GitHub)" <gi...@apache.org>.
bvolpato commented on code in PR #39592:
URL: https://github.com/apache/beam/pull/39592#discussion_r3709588587
##########
sdks/java/extensions/sql/src/main/java/org/apache/beam/sdk/extensions/sql/impl/rel/BeamCalcRel.java:
##########
@@ -684,6 +699,12 @@ private static Expression toCalciteValue(
Expressions.multiply(dateValue, Expressions.constant(MILLIS_PER_DAY)),
Expressions.divide(timeValue, Expressions.constant(NANOS_PER_MILLISECOND)));
return nullOr(value, returnValue);
+ } else if (org.apache.beam.sdk.schemas.logicaltypes.Timestamp.IDENTIFIER.equals(
+ identifier)) {
+ return nullOr(
+ value,
+ Expressions.call(
+ Expressions.convert_(value, java.time.Instant.class), "toEpochMilli"));
Review Comment:
can contain sub-millisecond values, but this conversion goes through epoch milliseconds. I reproduced this with : comes back as . Could we preserve microsecond precision here, or reject values that Calcite cannot represent without loss?
##########
sdks/java/extensions/sql/src/main/java/org/apache/beam/sdk/extensions/sql/impl/rel/BeamCalcRel.java:
##########
@@ -684,6 +699,12 @@ private static Expression toCalciteValue(
Expressions.multiply(dateValue, Expressions.constant(MILLIS_PER_DAY)),
Expressions.divide(timeValue, Expressions.constant(NANOS_PER_MILLISECOND)));
return nullOr(value, returnValue);
+ } else if (org.apache.beam.sdk.schemas.logicaltypes.Timestamp.IDENTIFIER.equals(
+ identifier)) {
+ return nullOr(
+ value,
+ Expressions.call(
+ Expressions.convert_(value, java.time.Instant.class), "toEpochMilli"));
Review Comment:
`Timestamp.MICROS` can contain sub-millisecond values, but this conversion goes through epoch milliseconds. I reproduced this with `SELECT * FROM PCOLLECTION`: `2025-07-31T20:17:40.123456Z` comes back as `2025-07-31T20:17:40.123Z`. Could we preserve microsecond precision here, or reject values that Calcite cannot represent without loss?
--
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: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] add Timestamp.MICROS for iceberg timestamptz [beam]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #39592:
URL: https://github.com/apache/beam/pull/39592#issuecomment-5171156376
Assigning reviewers:
R: @kennknowles for label java.
Note: If you would like to opt out of this review, comment `assign to next reviewer`.
Available commands:
- `stop reviewer notifications` - opt out of the automated review tooling
- `remind me after tests pass` - tag the comment author after tests pass
- `waiting on author` - shift the attention set back to the author (any comment or push by the author will return the attention set to the reviewers)
The PR bot will only process comments in the main thread (not review comments).
--
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: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] add Timestamp.MICROS for iceberg timestamptz [beam]
Posted by "aIbrahiim (via GitHub)" <gi...@apache.org>.
aIbrahiim commented on PR #39592:
URL: https://github.com/apache/beam/pull/39592#issuecomment-5170742617
cc: @ahmedabu98
--
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: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] add Timestamp.MICROS for iceberg timestamptz [beam]
Posted by "ahmedabu98 (via GitHub)" <gi...@apache.org>.
ahmedabu98 commented on code in PR #39592:
URL: https://github.com/apache/beam/pull/39592#discussion_r3716326985
##########
sdks/java/extensions/sql/src/test/java/org/apache/beam/sdk/extensions/sql/BeamComplexTypeTest.java:
##########
@@ -797,4 +798,35 @@ public void testUnknownLogicalType() {
assertEquals(inputRow.getSchema(), outputRow.getSchema());
pipeline.run().waitUntilFinish(Duration.standardMinutes(1));
}
+
+ @Test
+ public void testSqlTimestampMicrosLogicalType() {
Review Comment:
maybe rename to `testSqlTimestampLogicalType` because the test value is in millis precision?
--
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: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org