{"record":{"id":"d2740d5ef14f3337","repo":"apache/iceberg","slug":"this-getclass-getname-does-not-implement-c","errorCode":null,"errorMessage":"this.getClass().getName() + \" does not implement create with a sort order\"","messagePattern":"this\\.getClass\\(\\)\\.getName\\(\\) \\+ \" does not implement create with a sort order\"","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"api/src/main/java/org/apache/iceberg/Tables.java","lineNumber":50,"sourceCode":"    return create(schema, PartitionSpec.unpartitioned(), ImmutableMap.of(), tableIdentifier);\n  }\n\n  default Table create(Schema schema, PartitionSpec spec, String tableIdentifier) {\n    return create(schema, spec, ImmutableMap.of(), tableIdentifier);\n  }\n\n  default Table create(\n      Schema schema, PartitionSpec spec, Map<String, String> properties, String tableIdentifier) {\n    return create(schema, spec, SortOrder.unsorted(), properties, tableIdentifier);\n  }\n\n  default Table create(\n      Schema schema,\n      PartitionSpec spec,\n      SortOrder order,\n      Map<String, String> properties,\n      String tableIdentifier) {\n    throw new UnsupportedOperationException(\n        this.getClass().getName() + \" does not implement create with a sort order\");\n  }\n\n  Table load(String tableIdentifier);\n\n  boolean exists(String tableIdentifier);\n}\n","sourceCodeStart":32,"sourceCodeEnd":58,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/api/src/main/java/org/apache/iceberg/Tables.java#L32-L58","documentation":"The default Tables.create(Schema, PartitionSpec, SortOrder, Map, String) throws UnsupportedOperationException because the Tables abstraction predates sort orders; only Tables implementations that support sort orders override this five-argument create. The message names the concrete Tables class that lacks support.","triggerScenarios":"Calling tables.create(schema, spec, sortOrder, properties, identifier) on a Tables implementation (e.g. HadoopTables or custom implementations) that only overrides the older four-argument create without a SortOrder.","commonSituations":"Creating tables with an explicit sort order via HadoopTables or a custom Tables implementation; utility code that passes a SortOrder unconditionally even when the target catalog backend doesn't support it.","solutions":["Use a Catalog implementation (e.g. HadoopCatalog/HiveCatalog via Catalog.buildTable) which supports sort orders, instead of the legacy Tables interface.","Drop the SortOrder argument and call the older create(schema, spec, properties, identifier), then apply sort order via table.updateSortOrder() or rebuild the table.","Upgrade the Tables implementation so it overrides the sort-order-aware create.","Catch UnsupportedOperationException and fall back to the unsorted create path."],"exampleFix":"// before\nTable table = tables.create(schema, spec, sortOrder, props, ident);\n\n// after\nCatalog catalog = ...; // a real Catalog implementation\nTable table = catalog\n    .buildTable(TableIdentifier.parse(ident), schema)\n    .withPartitionSpec(spec)\n    .withSortOrder(sortOrder)\n    .withProperties(props)\n    .create();","handlingStrategy":"fallback","validationCode":"// ensure the Tables implementation supports sort orders, or use Catalog\nboolean supportsSortOrderCreate = !(tables instanceof org.apache.iceberg.hadoop.HadoopTables);\nif (!supportsSortOrderCreate) { useCatalogBuildTable(); }","typeGuard":"Table createWithOrder(Tables tables, Schema schema, PartitionSpec spec,\n    SortOrder order, Map<String, String> props, String ident) {\n  try {\n    return tables.create(schema, spec, order, props, ident);\n  } catch (UnsupportedOperationException e) {\n    return tables.create(schema, spec, props, ident); // unsorted fallback\n  }\n}","tryCatchPattern":"Table t;\ntry {\n  t = tables.create(schema, spec, order, props, ident);\n} catch (UnsupportedOperationException e) {\n  t = catalog.buildTable(TableIdentifier.parse(ident), schema)\n      .withPartitionSpec(spec).withSortOrder(order).withProperties(props).create();\n}","preventionTips":["Prefer the Catalog.buildTable(...) API for new table creation — it supports sort orders everywhere","Check whether your Tables implementation (e.g. HadoopTables) overrides the sort-order-aware create","Only pass a SortOrder when the backend was verified to support it"],"tags":["unsupported-operation","sort-order","table-creation"],"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"}