Skip to content

Commit

Permalink
add constant to specify min version
Browse files Browse the repository at this point in the history
  • Loading branch information
HonahX committed Jan 15, 2025
1 parent 1bc5075 commit 34c480a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 2 additions & 0 deletions core/src/main/java/org/apache/iceberg/TableMetadata.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ public class TableMetadata implements Serializable {
static final int INITIAL_SPEC_ID = 0;
static final int INITIAL_SORT_ORDER_ID = 1;
static final int INITIAL_SCHEMA_ID = 0;
static final int BRANCHING_MIN_SUPPORT_VERSION = 2;
static final int UUID_REQUIRED_MIN_VERSION = 2;

private static final long ONE_MINUTE = TimeUnit.MINUTES.toMillis(1);

Expand Down
10 changes: 6 additions & 4 deletions core/src/test/java/org/apache/iceberg/TestTableMetadata.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
*/
package org.apache.iceberg;

import static org.apache.iceberg.TableMetadata.BRANCHING_MIN_SUPPORT_VERSION;
import static org.apache.iceberg.TableMetadata.UUID_REQUIRED_MIN_VERSION;
import static org.apache.iceberg.TableMetadataParser.CURRENT_SNAPSHOT_ID;
import static org.apache.iceberg.TableMetadataParser.FORMAT_VERSION;
import static org.apache.iceberg.TableMetadataParser.LAST_COLUMN_ID;
Expand Down Expand Up @@ -277,7 +279,7 @@ public void testBackwardCompat() throws Exception {
@ParameterizedTest
@FieldSource("org.apache.iceberg.TestHelpers#ALL_VERSIONS")
public void testInvalidMainBranch(int formatVersion) throws IOException {
assumeThat(formatVersion).isGreaterThanOrEqualTo(2);
assumeThat(formatVersion).isGreaterThanOrEqualTo(BRANCHING_MIN_SUPPORT_VERSION);

long previousSnapshotId = System.currentTimeMillis() - new Random(1234).nextInt(3600);

Expand Down Expand Up @@ -322,7 +324,7 @@ public void testInvalidMainBranch(int formatVersion) throws IOException {
@ParameterizedTest
@FieldSource("org.apache.iceberg.TestHelpers#ALL_VERSIONS")
public void testMainWithoutCurrent(int formatVersion) throws IOException {
assumeThat(formatVersion).isGreaterThanOrEqualTo(2);
assumeThat(formatVersion).isGreaterThanOrEqualTo(BRANCHING_MIN_SUPPORT_VERSION);

long snapshotId = System.currentTimeMillis() - new Random(1234).nextInt(3600);

Expand Down Expand Up @@ -643,8 +645,8 @@ public void testAddPreviousMetadataRemoveMultiple(int formatVersion) throws IOEx

@ParameterizedTest
@FieldSource("org.apache.iceberg.TestHelpers#ALL_VERSIONS")
public void testV2UUIDValidation(int formatVersion) {
assumeThat(formatVersion).isGreaterThanOrEqualTo(2);
public void testUUIDValidation(int formatVersion) {
assumeThat(formatVersion).isGreaterThanOrEqualTo(UUID_REQUIRED_MIN_VERSION);

assertThatThrownBy(
() ->
Expand Down

0 comments on commit 34c480a

Please sign in to comment.