voonhous commented on code in PR #19029:
URL: https://github.com/apache/hudi/pull/19029#discussion_r3664724266
##########
hudi-common/src/test/java/org/apache/hudi/internal/schema/utils/TestAvroSchemaEvolutionUtils.java:
##########
@@ -563,8 +563,68 @@ public void
testNotEvolveSchemaIfReconciledSchemaUnchanged() {
InternalSchema oldInternalSchema =
InternalSchemaConverter.convert(oldSchema);
// set a non-default schema id for old table schema, e.g., 2.
oldInternalSchema.setSchemaId(2);
- InternalSchema evolvedSchema =
AvroSchemaEvolutionUtils.reconcileSchema(incomingSchema.getAvroSchema(),
oldInternalSchema, false);
+ InternalSchema evolvedSchema =
AvroSchemaEvolutionUtils.reconcileSchema(incomingSchema.getAvroSchema(),
oldInternalSchema, false, false);
// the evolved schema should be the old table schema, since there is no
type change at all.
Assertions.assertEquals(oldInternalSchema, evolvedSchema);
}
+
+ @Test
+ public void testReconcileSchemaTimestampPrecisionEvolution() {
Review Comment:
Added, and it turned out to matter more than a missing assertion.
`reconcileSchema` did reject cross-zone via `isTypeUpdateAllow`, but
`reconcileTimestampLogicalType` only checked `isGatedTimestampChange`, which is
`false` for a UTC/local pair, so it skipped the field entirely. That guard is
the only one on the default non-reconcile path, and the Avro reader/writer
check after it is logical-type-blind for two long-backed fields -- so a
`timestamp-micros` table silently became `local-timestamp-micros` on the next
commit. Same silent relabel this whole change set exists to prevent.
Wrote the test first and it failed. Now fixed in the guard: a zone change
throws with its own message, and no override unlocks it, since no rescale
expresses it. `testCrossZoneTimestampChangeIsRejected` covers both entry
points, both directions, override-can't-unlock, zone+precision together, and a
same-zone control.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]