apache/iceberg · error
apply(value) is deprecated, use bind(Type).apply(value)
Error message
apply(value) is deprecated, use bind(Type).apply(value)
What it means
Transform.apply(value) is a deprecated default method that always throws UnsupportedOperationException to force migration to the bound API. Iceberg transforms must be bound to a source Type (via bind(Type)) before use, because the actual transform function depends on the column's type. Calling the unbound apply() directly is no longer supported and will be removed in 2.0.0.
Source
Thrown at api/src/main/java/org/apache/iceberg/transforms/Transform.java:49
* A transform function used for partitioning.
*
* <p>Implementations of this interface can be used to transform values, check or types, and project
* {@link BoundPredicate predicates} to predicates on partition values.
*
* @param <S> Java class of source values
* @param <T> Java class of transformed values
*/
public interface Transform<S, T> extends Serializable {
/**
* Transforms a value to its corresponding partition value.
*
* @param value a source value
* @return a transformed partition value
* @deprecated use {@link #bind(Type)} instead; will be removed in 2.0.0
*/
@Deprecated
default T apply(S value) {
throw new UnsupportedOperationException(
"apply(value) is deprecated, use bind(Type).apply(value)");
}
/**
* Returns a function that applies this transform to values of the given {@link Type type}.
*
* @param type an Iceberg {@link Type}
* @return a {@link Function} that applies this transform to values of the given type.
*/
default SerializableFunction<S, T> bind(Type type) {
throw new UnsupportedOperationException("bind is not implemented");
}
/**
* Checks whether this function can be applied to the given {@link Type}.
*
* @param type a type
* @return true if this transform can be applied to the type, false otherwiseView on GitHub (pinned to 86d9c8fc54)
Solutions
- Call bind(type) first and use the returned function: transform.bind(sourceType).apply(value)
- Replace deprecated apply(value) call sites with the bound pattern
- Catch UnsupportedOperationException during migration to find remaining unbound call sites
Example fix
// before Object part = Transforms.bucket(16).apply(value); // after Object part = Transforms.bucket(16).bind(sourceType).apply(value);
Defensive patterns
Strategy: type-guard
Validate before calling
if (transform instanceof BoundTransform || function != null) { /* safe to apply */ } Type guard
static <S, T> SerializableFunction<S, T> bound(Transform<S, T> t, Type type) {
return t.bind(type);
} Try / catch
try { return transform.bind(type).apply(value); } catch (UnsupportedOperationException e) { throw new IllegalStateException("Transform not bound; call bind(type) first", e); } Prevention
- Never call Transform.apply(value) directly — always bind first
- Grep the codebase for ".apply(" on Transform instances and migrate to bind(type).apply(...)
- Note that apply(value) is removed in Iceberg 2.0.0 — migrate proactively
When it happens
Trigger: Directly calling transform.apply(value) on any Transform (e.g. Transforms.bucket(...).apply(v)) instead of first calling bind(type) and invoking apply on the returned SerializableFunction.
Common situations: Older code written against pre-binding Iceberg APIs that was upgraded to a newer Iceberg version; copy-pasted examples from outdated documentation.
Understand the failure class
Background: "is deprecated and will be removed" — deprecation warnings for old API names, keywords, and options, and how to migrate before the removal release — this error's family across 29 libraries.
Related errors
- apply(value) is deprecated, use bind(Type).apply(value)
- Unsupported time unit: + granularity
- Unsupported time unit: + timestampUnit
- bind is not implemented
- Unsupported binary type: + value.getClass()
AI-assisted analysis of apache/iceberg@86d9c8fc54 (2026-09-12).
Data as JSON: /api/errors/7b15aad106390330.
Report an issue: GitHub.