Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support both adjust-to-utc and local-timestamp-micros in Avro Data Type Mappings #11903

Open
2 of 3 tasks
Gezi-lzq opened this issue Jan 3, 2025 · 1 comment
Open
2 of 3 tasks
Labels
improvement PR that improves existing functionality

Comments

@Gezi-lzq
Copy link

Gezi-lzq commented Jan 3, 2025

Feature Request / Improvement

Hi folks,

I would like to understand more about the statement "Avro type annotation adjust-to-utc is an Iceberg convention,” given that Avro already has the Logical Type local-timestamp-micros. Should Iceberg support both the adjust-to-utc and local-timestamp-micros methods simultaneously?

timestamptz:

https://iceberg.apache.org/spec/#avro

{
  "type": "long",
  "logicalType": "timestamp-micros",
  "adjust-to-utc": true
}

and

https://avro.apache.org/docs/1.10.2/spec.html#Decimal

{
  "type": "long",
  "logicalType": "local-timestamp-micros"
}

Reference class:
org.apache.iceberg.avro.SchemaToType#primitive

@rdblue

Query engine

Other

Willingness to contribute

  • I can contribute this improvement/feature independently
  • I would be willing to contribute this improvement/feature with guidance from the Iceberg community
  • I cannot contribute this improvement/feature at this time
@Gezi-lzq Gezi-lzq added the improvement PR that improves existing functionality label Jan 3, 2025
@Gezi-lzq Gezi-lzq changed the title Support both adjust-to-utc and local-timestamp-micros in Iceberg Support both adjust-to-utc and local-timestamp-micros in Iceberg Avro Jan 3, 2025
@Gezi-lzq Gezi-lzq changed the title Support both adjust-to-utc and local-timestamp-micros in Iceberg Avro Support both adjust-to-utc and local-timestamp-micros in Avro Data Type Mappings Jan 3, 2025
@anesterenok
Copy link

+1 for this one.
In fact, I do not even understand why Iceberg uses a specified logical type in a way it was never intended to be used.

Avro spec states:

The timestamp-micros logical type represents an instant on the global timeline, independent of a particular time zone or calendar, with a precision of one microsecond.

Any Avro client reading logicalType "timestamp-micros" will expect an Instant, as per Avro spec. If Iceberg wanted to define its own type for local timestamps, they should had used their own logical type, not change the specified one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
improvement PR that improves existing functionality
Projects
None yet
Development

No branches or pull requests

2 participants