{"record":{"id":"4adde436668c8292","repo":"apache/beam","slug":"unsupported-format-format","errorCode":null,"errorMessage":"Unsupported format: {format}","messagePattern":"Unsupported format: (.+?)","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"sdks/java/io/iceberg/src/main/java/org/apache/beam/sdk/io/iceberg/AddFiles.java","lineNumber":836,"sourceCode":"      FileFormat format,\n      MetricsConfig config,\n      NameMapping mapping,\n      @Nullable ParquetMetadata preReadFooter) {\n    switch (format) {\n      case PARQUET:\n        ParquetMetadata footer =\n            checkStateNotNull(preReadFooter, \"Parquet metrics require the pre-read footer\");\n        MessageType originalMessageType = footer.getFileMetaData().getSchema();\n        if (!ParquetSchemaUtil.hasIds(originalMessageType)) {\n          footer = getFooterWithTypeIds(originalMessageType, footer, mapping);\n        }\n        return ParquetUtil.footerMetrics(footer, Stream.empty(), config, mapping);\n      case ORC:\n        return OrcMetrics.fromInputFile(file, config, mapping);\n      case AVRO:\n        return new Metrics(Avro.rowCount(file), null, null, null, null);\n      default:\n        throw new UnsupportedOperationException(\"Unsupported format: \" + format);\n    }\n  }\n\n  /**\n   * Some exceptions carry a null message (bare EOFException, NPE); the error-routing path must\n   * never throw on one.\n   */\n  static String errorMessage(Throwable e) {\n    return e.getMessage() != null ? e.getMessage() : e.toString();\n  }\n\n  /** Tries to infer other file formats. Defaults to Parquet. */\n  public static FileFormat inferFormat(String path) {\n    String lowerPath = path.toLowerCase();\n\n    if (lowerPath.endsWith(\".parquet\") || lowerPath.endsWith(\".pqt\")) {\n      return FileFormat.PARQUET;\n    } else if (lowerPath.endsWith(\".orc\")) {","sourceCodeStart":818,"sourceCodeEnd":854,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/io/iceberg/src/main/java/org/apache/beam/sdk/io/iceberg/AddFiles.java#L818-L854","documentation":"AddFiles.fileMetrics selects a metrics extractor based on the detected FileFormat (PARQUET, ORC, AVRO). If the switch reaches default, the format is one the library cannot compute metrics for, so it throws UnsupportedOperationException with the format name. This guards against silently skipping metrics needed for partition inference.","triggerScenarios":"Invoking AddFiles on a table whose data files are in a FileFormat outside PARQUET/ORC/AVRO (or a future/unknown enum constant).","commonSituations":"Importing files written in another format (e.g. MERGE/JSON) into an Iceberg table; custom FileFormat enum values from an Iceberg fork; format detection returning a value added in a newer Iceberg release than the Beam connector supports.","solutions":["Convert the files to Parquet/ORC/AVRO before adding them to the table","Upgrade the iceberg and beam-sdks-java-io-iceberg dependency versions so new formats are supported","Skip unsupported files explicitly and import them through a separate path","Log and filter files by extension during planning instead of letting the worker throw"],"exampleFix":"// before\nADD FILES FROM 'hdfs:///data/*.json'\n// after\nspark.read.json(\"hdfs:///data/\").write.parquet(\"hdfs:///data_parquet/\")\n// then add files from data_parquet","handlingStrategy":"validation","validationCode":"Set<FileFormat> ok = Set.of(FileFormat.PARQUET, FileFormat.ORC, FileFormat.AVRO); files.removeIf(f -> !ok.contains(formatOf(f)));","typeGuard":"null","tryCatchPattern":"try { metrics = fileMetrics(...); } catch (UnsupportedOperationException e) { log.warn(\"Skipping unsupported format\", e); skip(file); }","preventionTips":["Standardize on Parquet/ORC/AVRO before import","Convert foreign formats first","Keep iceberg deps at versions supporting your formats","Filter manifest listings by extension"],"tags":["java","iceberg","file-format","unsupported"],"backgroundTag":"unsupported-enum-value","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}