Skip to content

[Bug] Hive timestamp mapped to Paimon millisecond precision #8642

Description

@thswlsqls

Search before asking

  • I searched in the issues and found nothing similar.

Paimon version
master @ 711481b

Compute Engine
Hive

Minimal reproduce step
HiveTypeUtils.HiveToPaimonTypeVisitor.atomic() (paimon-hive/paimon-hive-common/.../HiveTypeUtils.java line ~312) maps Hive timestamp to DataTypes.TIMESTAMP_MILLIS() (precision 3). This runs whenever a Hive schema is inferred into Paimon (migrate / clone / CREATE via Hive). Hive timestamp holds up to nanosecond precision, so any sub-millisecond fraction is silently truncated.

What doesn't meet your expectations?
The mapping should preserve precision like its siblings. In the same file, the local-zoned reverse path returns DataTypes.TIMESTAMP_WITH_LOCAL_TIME_ZONE() (default precision 6), and SparkTypeUtils.java:436 maps timestamp to new TimestampType() (precision 6). Only the Hive timestamp path drops to precision 3, producing an inconsistent, lossy schema.

Anything else?
Proposed fix: use DataTypes.TIMESTAMP() (precision 6) for parity with the same-file LTZ path and SparkTypeUtils. Open design point: precision 9 would be fully lossless for Hive nanosecond timestamps — worth a committer's decision. Existing persisted schemas are unaffected; only newly inferred schemas change.

Are you willing to submit a PR?

  • I'm willing to submit a PR!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions