singhpk234 commented on code in PR #14462:
URL: https://github.com/apache/iceberg/pull/14462#discussion_r2483055060


##########
api/src/main/java/org/apache/iceberg/expressions/Expressions.java:
##########
@@ -102,6 +102,38 @@ public static <T> UnboundTerm<T> truncate(String name, int 
width) {
     return new UnboundTransform<>(ref(name), Transforms.truncate(width));
   }
 
+  @SuppressWarnings("unchecked")
+  public static <S, T> UnboundTerm<T> bucket(NamedReference<S> resolvedRef, 
int numBuckets) {
+    Transform<S, T> transform = (Transform<S, T>) 
Transforms.bucket(numBuckets);
+    return new UnboundTransform<>(resolvedRef, transform);
+  }
+
+  @SuppressWarnings("unchecked")
+  public static <S, T> UnboundTerm<T> year(NamedReference<S> resolvedRef) {
+    return new UnboundTransform<>(resolvedRef, (Transform<S, T>) 
Transforms.year());
+  }
+
+  @SuppressWarnings("unchecked")
+  public static <S, T> UnboundTerm<T> month(NamedReference<S> resolvedRef) {
+    return new UnboundTransform<>(resolvedRef, (Transform<S, T>) 
Transforms.month());
+  }
+
+  @SuppressWarnings("unchecked")
+  public static <S, T> UnboundTerm<T> day(NamedReference<S> resolvedRef) {
+    return new UnboundTransform<>(resolvedRef, (Transform<S, T>) 
Transforms.day());
+  }
+
+  @SuppressWarnings("unchecked")
+  public static <S, T> UnboundTerm<T> hour(NamedReference<S> resolvedRef) {
+    return new UnboundTransform<>(resolvedRef, (Transform<S, T>) 
Transforms.hour());
+  }
+
+  @SuppressWarnings("unchecked")
+  public static <S, T> UnboundTerm<T> truncate(NamedReference<S> resolvedRef, 
int width) {
+    Transform<S, T> transform = (Transform<S, T>) Transforms.truncate(width);
+    return new UnboundTransform<>(resolvedRef, transform);
+  }
+

Review Comment:
   Present signatures : 
   ```
     public static <T> UnboundTerm<T> bucket(String name, int numBuckets) {
       Transform<?, T> transform = (Transform<?, T>) 
Transforms.bucket(numBuckets);
       return new UnboundTransform<>(ref(name), transform);
     }
   ```
   
   The signatures for those are tied to the String name, i can move this, the 
UnboundTerm as even in this function calls `ref(name)` which returns 
NamedReference, so we can mark above as deprecated and move to this new one, 
this way we have just one api and the caller needs to make sure it passes 
appropriate unboundTerm



-- 
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]

Reply via email to