Skip to content

[hive] Fix Hive timestamp mapped to Paimon millisecond precision#8643

Open
thswlsqls wants to merge 1 commit into
apache:masterfrom
thswlsqls:fix/hive-timestamp-precision
Open

[hive] Fix Hive timestamp mapped to Paimon millisecond precision#8643
thswlsqls wants to merge 1 commit into
apache:masterfrom
thswlsqls:fix/hive-timestamp-precision

Conversation

@thswlsqls

Copy link
Copy Markdown
Contributor

Purpose

fix #8642

  • HiveTypeUtils.HiveToPaimonTypeVisitor.atomic() mapped Hive timestamp to DataTypes.TIMESTAMP_MILLIS() (precision 3), silently truncating sub-millisecond values when a Hive schema is inferred into Paimon (migrate/clone/CREATE via Hive).
  • Change it to DataTypes.TIMESTAMP() (default precision 6) for parity with the same-file local-zoned reverse path (TIMESTAMP_WITH_LOCAL_TIME_ZONE(), precision 6) and SparkTypeUtils.java:436 (new TimestampType(), precision 6).
  • Existing persisted schemas are unchanged — only newly inferred migrate/clone/CREATE schemas move from precision 3 to 6.

Tests

  • Added HiveTypeUtilsTest#testToPaimonTypeTimestampPrecision asserting toPaimonType("timestamp") equals DataTypes.TIMESTAMP() and its precision equals the local-zoned reverse-path precision.
  • mvn -pl paimon-hive/paimon-hive-common -am clean install (JDK 11) — HiveTypeUtilsTest: 2 tests passed.

@JingsongLi

Copy link
Copy Markdown
Contributor

Test fail.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Hive timestamp mapped to Paimon millisecond precision

2 participants