{"record":{"id":"9259b1d145c75ee8","repo":"apache/iceberg","slug":"transform-is-not-supported","errorCode":null,"errorMessage":"Transform is not supported: ","messagePattern":"Transform is not supported: ","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"spark/v4.0/spark/src/main/java/org/apache/iceberg/spark/Spark3Util.java","lineNumber":408,"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":390,"sourceCodeEnd":426,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/spark/v4.0/spark/src/main/java/org/apache/iceberg/spark/Spark3Util.java#L390-L426","documentation":"Thrown when converting a Spark sort expression's transform to an Iceberg term and the transform is not one of the supported set (identity, year/month/day/hour, bucket, truncate, zorder, etc.). The default branch rejects unknown Transform values.","triggerScenarios":"Using a Spark transform (e.g. unsupported function-based transform) in sort columns or bucketing DDL that Spark3Util.toIcebergTerm translates, with the transform falling into the default case.","commonSituations":"Custom Spark transforms in CREATE TABLE ... CLUSTERED BY / SORTED BY; Spark upgrades adding new standard transforms; typos in transform functions.","solutions":["Use a supported transform: identity, year, month, day, hour, bucket, truncate, or zorder","Check the exact transform named in the message and map it to a supported equivalent","Upgrade Iceberg if the transform is newly standardized in Spark"],"exampleFix":"-- before\nCREATE TABLE t (id bigint) USING iceberg SORTED BY (date_trunc('week', ts));\n-- after\nCREATE TABLE t (id bigint) USING iceberg SORTED BY (day(ts));","handlingStrategy":"validation","validationCode":"Transform t = ...; Set<String> supported = Set.of(\"identity\",\"year\",\"month\",\"day\",\"hour\",\"bucket\",\"truncate\",\"zorder\"); if (!supported.contains(t.name().toLowerCase(Locale.ROOT))) { throw new IllegalArgumentException(\"Transform not supported: \" + t.name()); }","typeGuard":"boolean isSupportedTransform(Transform<?> t) { return List.of(\"identity\",\"year\",\"month\",\"day\",\"hour\",\"bucket\",\"truncate\",\"zorder\").contains(t.name().toLowerCase(Locale.ROOT)); }","tryCatchPattern":"try { SortOrder order = Spark3Util.toIcebergTerm(transform, ...); } catch (UnsupportedOperationException e) { LOG.error(\"Map this transform manually: {}\", e.getMessage()); throw e; }","preventionTips":["Restrict generated DDL to identity/year/month/day/hour/bucket/truncate/zorder transforms","Validate transform functions in SQL templating before execution","Keep Iceberg updated when Spark adds new standard transforms"],"tags":["spark","transform","sort-order"],"backgroundTag":"unsupported-operation","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"}