voonhous commented on code in PR #19809:
URL: https://github.com/apache/hudi/pull/19809#discussion_r3916152801
##########
hudi-common/src/main/java/org/apache/hudi/common/schema/HoodieSchemaTypePromotion.java:
##########
@@ -19,20 +19,28 @@
package org.apache.hudi.common.schema;
/**
- * Defines type promotion rules for HoodieSchema compatibility checking.
+ * The single table of primitive widening promotions, used by {@link
HoodieSchemaProjectionChecker}.
*
- * <p>Type promotion allows a reader schema with a "wider" type to read data
- * written with a "narrower" type. This follows Avro's type promotion
rules.</p>
- *
- * <p>Supported promotions:
+ * <p>A promotion lets a reader schema with a wider type read data written
with a narrower one:</p>
* <ul>
- * <li>INT → LONG, FLOAT, DOUBLE</li>
- * <li>LONG → FLOAT, DOUBLE</li>
- * <li>FLOAT → DOUBLE</li>
- * <li>STRING ↔ BYTES (bidirectional)</li>
- * <li>Decimal precision widening: (p2-s2) ≥ (p1-s1) and s2 ≥ s1</li>
+ * <li>INT -> LONG, FLOAT, DOUBLE</li>
+ * <li>LONG -> FLOAT, DOUBLE</li>
+ * <li>FLOAT -> DOUBLE</li>
+ * <li>STRING <-> BYTES (bidirectional)</li>
+ * <li>STRING <- any numeric type</li>
+ * <li>decimal widening, see {@link #isDecimalWidening(HoodieSchema,
HoodieSchema)}</li>
* </ul>
- * </p>
+ *
+ * <p>Logical-type-over-primitive promotions are deliberately NOT in this
table. A TIMESTAMP reader over a
+ * LONG writer, or a UUID reader over a STRING writer, is accepted by
+ * {@link HoodieSchemaCompatibilityChecker} for reader/writer compatibility,
but it must not make a bare
+ * long a "compatible projection" of a timestamp: writer-schema deduction
would then silently drop the
+ * logical type. Compatibility and projection are different questions, so they
use different tables.</p>
+ *
+ * <p>One more difference is documented rather than resolved:
+ * {@link #isDecimalWidening(HoodieSchema, HoodieSchema)} additionally
requires the same backing (fixed
+ * versus bytes) and, for fixed, an equal fixed size, whereas the decimal
check in
+ * {@code HoodieSchemaCompatibilityChecker} compares only precision and
scale.</p>
*
* <p>This class is package-private and used internally by schema
compatibility checkers.</p>
Review Comment:
Done in d74b3cd4f3b6.
##########
hudi-common/src/main/java/org/apache/hudi/common/avro/AvroSchemaUtils.java:
##########
@@ -39,7 +39,14 @@
import static org.apache.hudi.common.util.ValidationUtils.checkState;
/**
- * Utils for Avro Schema.
+ * Avro-typed schema helpers, retained only as the delegate target of the call
sites that have not moved to
+ * HoodieSchema yet: {@link
org.apache.hudi.common.schema.HoodieSchemaUtils#asNullable(HoodieSchema)} and
+ * {@code HoodieSchemaUtils#createNullableSchema}, the field construction
inside {@link HoodieSchema.Blob},
+ * and a handful of internal uses in {@link HoodieAvroUtils}.
+ *
+ * <p>This class is being retired under #16639. Do not add methods here: the
HoodieSchema twin of every
+ * method on this class already exists, so use {@link
org.apache.hudi.common.schema.HoodieSchema} or
+ * {@link org.apache.hudi.common.schema.HoodieSchemaUtils} instead.</p>
Review Comment:
Done in d74b3cd4f3b6.
--
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]