{"record":{"id":"0580093dfcd5acaa","repo":"apache/iceberg","slug":"transform-is-not-supported-transform","errorCode":null,"errorMessage":"Transform is not supported: ${transform}","messagePattern":"Transform is not supported: (.+?)","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"spark/v3.5/spark/src/main/java/org/apache/iceberg/spark/Spark3Util.java","lineNumber":404,"sourceCode":"          return org.apache.iceberg.expressions.Expressions.month(colName);\n        case \"date\":\n        case \"day\":\n        case \"days\":\n          return org.apache.iceberg.expressions.Expressions.day(colName);\n        case \"date_hour\":\n        case \"hour\":\n        case \"hours\":\n          return org.apache.iceberg.expressions.Expressions.hour(colName);\n        case \"truncate\":\n          return org.apache.iceberg.expressions.Expressions.truncate(colName, findWidth(transform));\n        case \"zorder\":\n          return new Zorder(\n              Stream.of(transform.references())\n                  .map(ref -> DOT.join(ref.fieldNames()))\n                  .map(org.apache.iceberg.expressions.Expressions::ref)\n                  .collect(Collectors.toList()));\n        default:\n          throw new UnsupportedOperationException(\"Transform is not supported: \" + transform);\n      }\n\n    } else if (expr instanceof NamedReference) {\n      NamedReference ref = (NamedReference) expr;\n      return org.apache.iceberg.expressions.Expressions.ref(DOT.join(ref.fieldNames()));\n\n    } else {\n      throw new UnsupportedOperationException(\"Cannot convert unknown expression: \" + expr);\n    }\n  }\n\n  /**\n   * Converts Spark transforms into a {@link PartitionSpec}.\n   *\n   * @param schema the table schema\n   * @param partitioning Spark Transforms\n   * @return a PartitionSpec\n   */","sourceCodeStart":386,"sourceCodeEnd":422,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/spark/v3.5/spark/src/main/java/org/apache/iceberg/spark/Spark3Util.java#L386-L422","documentation":"toIcebergTerm converts Spark sort/ordering expressions and transforms into Iceberg terms. Within a SortOrder expression, recognized transforms include identity, bucket, truncate, years/months/days/hours, and zorder; any other transform hits the default branch and throws this UnsupportedOperationException.","triggerScenarios":"Spark ORDER BY / SORTED BY / clustering requests whose transform expression is one Iceberg doesn't support — e.g. arbitrary SQL functions wrapped around a column in a sort specification.","commonSituations":"Using Iceberg's z-order/cluster DDL extensions with transforms beyond the supported set; engine plugins generating custom transforms.","solutions":["Restrict sort/cluster transforms to identity, bucket, truncate, years, months, days, hours, or zorder","Apply unsupported transforms upstream before writing data","Upgrade Iceberg to a version that maps the desired transform"],"exampleFix":"// before\nSORTED BY (month(ts))\n// after\nSORTED BY (days(ts))","handlingStrategy":"type-guard","validationCode":"boolean supportedSortTransform(Transform t) { return Set.of(\"identity\",\"bucket\",\"truncate\",\"years\",\"months\",\"days\",\"hours\").contains(t.name().toLowerCase(Locale.ROOT)); }","typeGuard":"boolean isTransformOrRef(Expression e) { return e instanceof Transform || e instanceof NamedReference; }","tryCatchPattern":"try { Spark3Util.toIcebergTerm(expr); } catch (UnsupportedOperationException e) { if (e.getMessage().startsWith(\"Transform is not supported\")) { /* replace with a supported transform */ } else throw e; }","preventionTips":["Restrict SORTED BY / ordering clauses to supported transforms","Never wrap columns in arbitrary functions in clustering specs","Validate transform names against Iceberg's supported set before issuing DDL"],"tags":["spark","transform","sort-order","unsupported"],"backgroundTag":"unsupported-enum-value","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"}