apache/iceberg · error · UnsupportedOperationException

Unsupported transform: ${transform}

Error message

Unsupported transform: ${transform}

What it means

createPartitionSpec parses partition expressions like "days(ts)", "truncate(col,10)" from the iceberg.partition-by config. Recognized transforms are identity (no parens), year/month/day/hour, bucket, and truncate; anything else inside the parentheses throws UnsupportedOperationException.

Source

Thrown at kafka-connect/kafka-connect/src/main/java/org/apache/iceberg/connect/data/SchemaUtils.java:198

                break;
              case "hour":
              case "hours":
                specBuilder.hour(matcher.group(2));
                break;
              case "bucket":
                {
                  Pair<String, Integer> args = transformArgPair(matcher.group(2));
                  specBuilder.bucket(args.first(), args.second());
                  break;
                }
              case "truncate":
                {
                  Pair<String, Integer> args = transformArgPair(matcher.group(2));
                  specBuilder.truncate(args.first(), args.second());
                  break;
                }
              default:
                throw new UnsupportedOperationException("Unsupported transform: " + transform);
            }
          } else {
            specBuilder.identity(partitionField);
          }
        });
    return specBuilder.build();
  }

  private static Pair<String, Integer> transformArgPair(String argsStr) {
    List<String> parts = Splitter.on(',').splitToList(argsStr);
    if (parts.size() != 2) {
      throw new IllegalArgumentException("Invalid argument " + argsStr + ", should have 2 parts");
    }
    return Pair.of(parts.get(0).trim(), Integer.parseInt(parts.get(1).trim()));
  }

  static Type toIcebergType(Schema valueSchema, IcebergSinkConfig config) {
    return new SchemaGenerator(config).toIcebergType(valueSchema);

View on GitHub (pinned to 86d9c8fc54)

Solutions

  1. Use supported transforms: identity (bare column), years/months/days/hours, bucket[N](col), truncate[W](col).
  2. Replace legacy Hive names (e.g. 'date(ts)') with Iceberg 'days(ts)'.
  3. Fix typos in the partition-by configuration.

Example fix

// before
"iceberg.partition-by": "date(event_time)"
// after
"iceberg.partition-by": "days(event_time)"
Defensive patterns

Strategy: validation

Validate before calling

Set<String> allowed = Set.of("identity","year","years","month","months","day","days","hour","hours","bucket","truncate");
for (String p : partitionBy.split(",")) {
  String t = p.contains("(") ? p.substring(0, p.indexOf('(')) : p.trim();
  if (!allowed.contains(t.toLowerCase(Locale.ROOT)))
    throw new ConfigException("Unsupported transform: " + t);
}

Try / catch

try { spec = SchemaUtils.createPartitionSpec(schema, partitionBy); }
catch (UnsupportedOperationException e) { throw new ConfigException("Bad partition-by: " + e.getMessage(), e); }

Prevention

When it happens

Trigger: Setting iceberg.partition-by to a transform Iceberg's supported set doesn't include here, e.g. "date(col)", "decade(col)", "substr(col,1,3)".

Common situations: Config copied from Hive/Spark dialects with unsupported function names; typo like 'dayz' or 'timestampdays' (legacy naming).

Understand the failure class

Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.

Related errors


AI-assisted analysis of apache/iceberg@86d9c8fc54 (2026-09-12). Data as JSON: /api/errors/45b85eb1517d32a6. Report an issue: GitHub.