{"record":{"id":"27fa62d8eaeaf242","repo":"apache/iceberg","slug":"cannot-evaluate","errorCode":null,"errorMessage":"Cannot evaluate ","messagePattern":"Cannot evaluate ","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"api/src/main/java/org/apache/iceberg/expressions/BoundExtract.java","lineNumber":61,"sourceCode":"\n  @Override\n  public Type type() {\n    return type;\n  }\n\n  @Override\n  public boolean isEquivalentTo(BoundTerm<?> other) {\n    if (other instanceof BoundExtract) {\n      BoundExtract<?> that = (BoundExtract<?>) other;\n      return ref.isEquivalentTo(that.ref) && path.equals(that.path) && type.equals(that.type);\n    }\n\n    return false;\n  }\n\n  @Override\n  public T eval(StructLike struct) {\n    throw new UnsupportedOperationException(\"Cannot evaluate \" + this);\n  }\n\n  @Override\n  public String toString() {\n    return \"extract(\" + ref + \", path=\" + path + \", type=\" + type + \")\";\n  }\n}\n","sourceCodeStart":43,"sourceCodeEnd":69,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/api/src/main/java/org/apache/iceberg/expressions/BoundExtract.java#L43-L69","documentation":"BoundExtract represents an extract expression (pulling a value from a variant/object by path). Its eval(StructLike) has no general implementation, so calling it throws UnsupportedOperationException. Extract expressions must be resolved/lowered by the engine before evaluation.","triggerScenarios":"Calling eval(StructLike) directly on a BoundExtract expression instead of letting the scan/residual machinery handle it; binding an extract expression and trying row evaluation.","commonSituations":"Variant-type filter pushdown where the engine must interpret the extract path; custom evaluators encountering extract expressions they cannot lower.","solutions":["Lower extract expressions into engine-native evaluation before binding/evaluating","Filter out extract expressions from pure Iceberg row evaluation paths","Use ExpressionVisitors to detect BoundExtract and handle it specially","Upgrade Iceberg to a version with engine support for the extract operation"],"exampleFix":"// before\nObject v = boundExtract.eval(rowStruct); // throws\n// after\nif (boundExtract instanceof BoundExtract) {\n  // handle via engine-specific variant accessor, not generic eval\n  return;\n}\nObject v = expr.eval(rowStruct);","handlingStrategy":"type-guard","validationCode":"if (expr instanceof BoundExtract) { /* route to variant-capable evaluator */ }","typeGuard":"boolean isExtract = expr instanceof BoundExtract;","tryCatchPattern":"try { v = expr.eval(struct); } catch (UnsupportedOperationException e) { if (e.getMessage().contains(\"Cannot evaluate\")) { /* lower to engine-native evaluation */ } else { throw e; } }","preventionTips":["Detect BoundExtract via visitors before generic evaluation","Lower extract expressions into engine-native code paths","Keep extract expressions out of pure-core row evaluation"],"tags":["expressions","variant","unsupported-operation"],"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-14T16:17:12.679Z"}