nbdevos25 commented on code in PR #14266:
URL: https://github.com/apache/iceberg/pull/14266#discussion_r2542585245
##########
api/src/main/java/org/apache/iceberg/types/TypeUtil.java:
##########
@@ -423,14 +423,40 @@ public static Type find(Type type, Predicate<Type>
predicate) {
return visit(type, new FindTypeVisitor(predicate));
}
+ /**
+ * @deprecated will be removed in 2.0.0, use {@link
#isPromotionAllowed(Type, Type.PrimitiveType,
+ * Integer, boolean)} instead. This method does not take advantage of
table format or source
+ * id references
+ */
+ @Deprecated
public static boolean isPromotionAllowed(Type from, Type.PrimitiveType to) {
+ return TypeUtil.isPromotionAllowed(from, to, 2, false);
+ }
+
+ public static boolean isPromotionAllowed(
+ Type from, Type.PrimitiveType to, Integer formatVersion, boolean
sourceIdReference) {
// Warning! Before changing this function, make sure that the type change
doesn't introduce
// compatibility problems in partitioning.
if (from.equals(to)) {
return true;
}
switch (from.typeId()) {
+ case DATE:
Review Comment:
nit: if default return is false, could the following be potentially removed:
```
if (formatVersion < 3) {
return false;
} else if (sourceIdReference) {
return false;
}
```
Also, may be this potentially the code for `case DATE` is a candidate to be
a separate method?
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]