{"record":{"id":"5e556c919ff8eaec","repo":"apache/iceberg","slug":"unknown-partition-format","errorCode":null,"errorMessage":"Unknown partition format: ","messagePattern":"Unknown partition format: ","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"data/src/main/java/org/apache/iceberg/data/TableMigrationUtil.java","lineNumber":202,"sourceCode":"            });\n      } else if (format.contains(\"parquet\")) {\n        task.run(\n            index -> {\n              Metrics metrics =\n                  getParquetMetrics(fileStatus.get(index).getPath(), conf, metricsSpec, mapping);\n              datafiles[index] =\n                  buildDataFile(fileStatus.get(index), partitionValues, spec, metrics, \"parquet\");\n            });\n      } else if (format.contains(\"orc\")) {\n        task.run(\n            index -> {\n              Metrics metrics =\n                  getOrcMetrics(fileStatus.get(index).getPath(), conf, metricsSpec, mapping);\n              datafiles[index] =\n                  buildDataFile(fileStatus.get(index), partitionValues, spec, metrics, \"orc\");\n            });\n      } else {\n        throw new UnsupportedOperationException(\"Unknown partition format: \" + format);\n      }\n      return Arrays.asList(datafiles);\n    } catch (IOException e) {\n      throw new UncheckedIOException(\"Unable to list files in partition: \" + partitionUri, e);\n    } finally {\n      if (service != null) {\n        service.shutdown();\n      }\n    }\n  }\n\n  private static Metrics getAvroMetrics(Path path, Configuration conf) {\n    try {\n      InputFile file = HadoopInputFile.fromPath(path, conf);\n      long rowCount = Avro.rowCount(file);\n      return new Metrics(rowCount, null, null, null, null);\n    } catch (UncheckedIOException e) {\n      throw new RuntimeException(\"Unable to read Avro file: \" + path, e);","sourceCodeStart":184,"sourceCodeEnd":220,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/data/src/main/java/org/apache/iceberg/data/TableMigrationUtil.java#L184-L220","documentation":"TableMigrationUtil.listPartition lists data files in a partition and computes metrics per supported format (parquet, avro, orc). If the partition's file format string matches none of these, an UnsupportedOperationException 'Unknown partition format: <format>' is thrown — the format is not supported for migration.","triggerScenarios":"Calling listPartition (used by add_files/migration procedures) with a partition whose format is not 'parquet', 'avro', or 'orc' (case-sensitive), e.g. 'json', 'csv', 'text', or uppercase 'PARQUET'.","commonSituations":"Migrating legacy Hive tables containing non-Iceberg-supported formats (JSON/CSV/Text); inconsistent file extensions or mixed formats in one partition; format string derived with wrong case from table properties.","solutions":["Convert unsupported files to parquet/orc/avro before running the migration.","Pass the format in lowercase ('parquet', 'avro', 'orc') to listPartition.","Split the migration so partitions with unsupported formats are excluded or handled separately.","Verify the format argument against actual file extensions in the partition."],"exampleFix":"// before\nTableMigrationUtil.listPartition(list, partitionValues, \"JSON\", spec, conf, metricsSpec, mapping);\n\n// after: convert data first, or use a supported format\nTableMigrationUtil.listPartition(list, partitionValues, \"parquet\", spec, conf, metricsSpec, mapping);","handlingStrategy":"validation","validationCode":"Set<String> SUPPORTED = Set.of(\"parquet\", \"avro\", \"orc\");\nif (!SUPPORTED.contains(format.toLowerCase(Locale.ROOT))) {\n  throw new IllegalArgumentException(\"Format not migratable: \" + format);\n}","typeGuard":"boolean isMigratableFormat(String format) {\n  return format != null\n      && Set.of(\"parquet\", \"avro\", \"orc\").contains(format.toLowerCase(Locale.ROOT));\n}","tryCatchPattern":"try {\n  TableMigrationUtil.listPartition(list, values, format, spec, conf, metricsSpec, mapping);\n} catch (UnsupportedOperationException e) {\n  if (e.getMessage().startsWith(\"Unknown partition format\")) { convertOrSkipPartition(); }\n}","preventionTips":["Always pass lowercase format strings ('parquet'|'avro'|'orc').","Convert JSON/CSV/Text tables to parquet before running add_files/migration.","Scan partitions for mixed formats before migrating and handle them separately."],"tags":["migration","file-format","unsupported-operation","add-files"],"backgroundTag":"unsupported-format","analyzedSha":"86d9c8fc543e7c56c9f624eb725f76c9baff9570","analyzedAt":"2026-09-12T00:46:39.097Z","contentChangedAt":"2026-09-12T00:46:39.097Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}