{"record":{"id":"e7d3611d9c7bbd77","repo":"apache/iceberg","slug":"bind-is-not-implemented","errorCode":null,"errorMessage":"bind is not implemented","messagePattern":"bind is not implemented","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"api/src/main/java/org/apache/iceberg/transforms/Transform.java","lineNumber":60,"sourceCode":"   *\n   * @param value a source value\n   * @return a transformed partition value\n   * @deprecated use {@link #bind(Type)} instead; will be removed in 2.0.0\n   */\n  @Deprecated\n  default T apply(S value) {\n    throw new UnsupportedOperationException(\n        \"apply(value) is deprecated, use bind(Type).apply(value)\");\n  }\n\n  /**\n   * Returns a function that applies this transform to values of the given {@link Type type}.\n   *\n   * @param type an Iceberg {@link Type}\n   * @return a {@link Function} that applies this transform to values of the given type.\n   */\n  default SerializableFunction<S, T> bind(Type type) {\n    throw new UnsupportedOperationException(\"bind is not implemented\");\n  }\n\n  /**\n   * Checks whether this function can be applied to the given {@link Type}.\n   *\n   * @param type a type\n   * @return true if this transform can be applied to the type, false otherwise\n   */\n  boolean canTransform(Type type);\n\n  /**\n   * Returns the {@link Type} produced by this transform given a source type.\n   *\n   * @param sourceType a type\n   * @return the result type created by the apply method for the given type\n   */\n  Type getResultType(Type sourceType);\n","sourceCodeStart":42,"sourceCodeEnd":78,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/api/src/main/java/org/apache/iceberg/transforms/Transform.java#L42-L78","documentation":"Transform.bind(Type) is a default method that throws UnsupportedOperationException('bind is not implemented') for Transform implementations that have not overridden it. The binding step resolves the transform into a SerializableFunction specialized for the given type; a custom Transform that skipped overriding bind cannot do this. It is raised at bind time (e.g. from boundReferences during partition evaluation), not at apply time.","triggerScenarios":"Calling bind(type) on a custom Transform subclass that overrides apply/canTransform/toHumanString but not bind; using a hand-rolled Transform implementation in partition expression evaluation paths that call boundReferences.","commonSituations":"Implementing a custom partition transform for a spec read from an external system and forgetting bind; third-party Transform implementations that predate the bind() API and were never migrated.","solutions":["Override bind(Type) in the custom Transform to return a SerializableFunction for each supported type","If the transform cannot support binding, throw a descriptive exception in canTransform(type) so it is rejected before bind is reached","Migrate third-party/legacy Transform implementations to the bind()-based API"],"exampleFix":"// before\nclass MyTransform<S, T> implements Transform<S, T> {\n  public T apply(S value) { return doIt(value); } // no bind override\n}\n// after\nclass MyTransform<S, T> implements Transform<S, T> {\n  public SerializableFunction<S, T> bind(Type type) {\n    return value -> doIt(value);\n  }\n}","handlingStrategy":"try-catch","validationCode":"try { transform.bind(type); } catch (UnsupportedOperationException e) { /* custom transform does not support binding */ }","typeGuard":"if (transform.getClass().isAssignableFrom(CustomTransform.class)) {\n  // verify it overrides bind before use in partition evaluation\n}","tryCatchPattern":"try { fn = transform.bind(type); } catch (UnsupportedOperationException e) { throw new IllegalArgumentException(\"Transform \" + transform + \" does not support binding for type \" + type, e); }","preventionTips":["Always override bind(Type) when implementing custom Transforms","Test custom transforms through the bind() path, not just apply()","Use canTransform(type) to reject types the transform cannot bind to"],"tags":["java","iceberg","transform","custom-implementation","bind"],"backgroundTag":"method-not-implemented","analyzedSha":"86d9c8fc543e7c56c9f624eb725f76c9baff9570","analyzedAt":"2026-09-12T00:46:39.097Z","contentChangedAt":"2026-09-12T00:46:39.097Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}