diff --git a/core/src/main/java/org/apache/iceberg/hadoop/HadoopTables.java b/core/src/main/java/org/apache/iceberg/hadoop/HadoopTables.java index ac5e285c9c09..9a856b2e24d1 100644 --- a/core/src/main/java/org/apache/iceberg/hadoop/HadoopTables.java +++ b/core/src/main/java/org/apache/iceberg/hadoop/HadoopTables.java @@ -339,9 +339,9 @@ private Transaction newReplaceTableTransaction(boolean orCreate) { Map properties = propertiesBuilder.build(); TableMetadata metadata; if (ops.current() != null) { - metadata = ops.current().buildReplacement(schema, spec, SortOrder.unsorted(), location, properties); + metadata = ops.current().buildReplacement(schema, spec, sortOrder, location, properties); } else { - metadata = tableMetadata(schema, spec, null, properties, location); + metadata = tableMetadata(schema, spec, sortOrder, properties, location); } if (orCreate) {