Skip to content

Commit

Permalink
API: Add missing deprecations (apache#11734)
Browse files Browse the repository at this point in the history
  • Loading branch information
Fokko authored Dec 17, 2024
1 parent 3adcd89 commit ce7a4b4
Show file tree
Hide file tree
Showing 6 changed files with 65 additions and 0 deletions.
14 changes: 14 additions & 0 deletions api/src/main/java/org/apache/iceberg/transforms/Bucket.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@ static <T> Bucket<T> get(int numBuckets) {
return new Bucket<>(numBuckets);
}

/**
* Instantiates a new Bucket Transform
*
* @deprecated will be removed in 2.0.0; use {@link #get(int)} instead
*/
@Deprecated
@SuppressWarnings("unchecked")
static <T, B extends Bucket<T> & SerializableFunction<T, Integer>> B get(
Type type, int numBuckets) {
Expand Down Expand Up @@ -94,6 +100,14 @@ protected int hash(T value) {
"hash(value) is not supported on the base Bucket class");
}

/**
* Transforms a value to its corresponding partition value.
*
* @param value a source value
* @return a transformed partition value
* @deprecated will be removed in 2.0.0; use {@link #bind(Type)} instead
*/
@Deprecated
@Override
public Integer apply(T value) {
if (value == null) {
Expand Down
8 changes: 8 additions & 0 deletions api/src/main/java/org/apache/iceberg/transforms/Dates.java
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,14 @@ public Integer apply(Integer days) {
this.apply = new Apply(granularity);
}

/**
* Transforms a value to its corresponding partition value.
*
* @param days a source value
* @return a transformed partition value
* @deprecated will be removed in 2.0.0; use {@link #bind(Type)} instead
*/
@Deprecated
@Override
public Integer apply(Integer days) {
return apply.apply(days);
Expand Down
8 changes: 8 additions & 0 deletions api/src/main/java/org/apache/iceberg/transforms/Identity.java
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,14 @@ private Identity(Type type) {
this.type = type;
}

/**
* Transforms a value to its corresponding partition value.
*
* @param value a source value
* @return a transformed partition value
* @deprecated will be removed in 2.0.0; use {@link #bind(Type)} instead
*/
@Deprecated
@Override
public T apply(T value) {
return value;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,14 @@ enum Timestamps implements Transform<Long, Integer> {
this.apply = apply;
}

/**
* Transforms a value to its corresponding partition value.
*
* @param timestamp a source value
* @return a transformed partition value
* @deprecated will be removed in 2.0.0; use {@link #bind(Type)} instead
*/
@Deprecated
@Override
public Integer apply(Long timestamp) {
return apply.apply(timestamp);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,15 @@ public class UnknownTransform<S, T> implements Transform<S, T> {
this.transform = transform;
}

/**
* Transforms a value to its corresponding partition value.
*
* @param value a source value
* @return ∅
* @throws UnsupportedOperationException Implementation is unknown
* @deprecated will be removed in 2.0.0; use {@link #bind(Type)} instead
*/
@Deprecated
@Override
public T apply(S value) {
throw new UnsupportedOperationException(
Expand Down
18 changes: 18 additions & 0 deletions api/src/main/java/org/apache/iceberg/transforms/VoidTransform.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,14 @@ public Void apply(S t) {

private VoidTransform() {}

/**
* Transforms a value to its corresponding partition value.
*
* @param value a source value
* @return null
* @deprecated will be removed in 2.0.0; use {@link #bind(Type)} instead
*/
@Deprecated
@Override
public Void apply(Object value) {
return null;
Expand Down Expand Up @@ -84,6 +92,16 @@ public boolean isVoid() {
return true;
}

/**
* Returns a human-readable String representation of a transformed value.
*
* <p>null values will return "null"
*
* @param value a transformed value
* @return a human-readable String representation of null
* @deprecated will be removed in 2.0.0; use {@link #toHumanString(Type, Object)} instead
*/
@Deprecated
@Override
public String toHumanString(Void value) {
return "null";
Expand Down

0 comments on commit ce7a4b4

Please sign in to comment.