Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API: Add missing deprecations #11734

Merged
merged 3 commits into from
Dec 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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