Skip to content

Commit

Permalink
[apache#1460] feat(iceberg): Iceberg supports distributions.
Browse files Browse the repository at this point in the history
  • Loading branch information
Clearvive authored and Clearvive committed Jan 24, 2024
1 parent 44f1309 commit c9df667
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public CreateTableRequest toCreateTableRequest() {
}

/**
* Transforms the gravitino distribution to the distribution mode name of the iceberg table.
* Transforms the gravitino distribution to the distribution mode name of the Iceberg table.
*
* @param distribution The distribution of the table.
* @return The distribution mode name of the iceberg table.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
import java.util.UUID;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.iceberg.DistributionMode;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeAll;
Expand Down Expand Up @@ -554,7 +555,9 @@ public void testTableDistribution() {
.withColumns(icebergColumns.toArray(new IcebergColumn[0]))
.withComment("test_table")
.build();
Assertions.assertDoesNotThrow(() -> icebergTable.transformDistribution(Distributions.NONE));
String none =
Assertions.assertDoesNotThrow(() -> icebergTable.transformDistribution(Distributions.NONE));
Assertions.assertEquals(none, DistributionMode.NONE.modeName());

IllegalArgumentException illegalArgumentException =
Assertions.assertThrows(
Expand Down Expand Up @@ -591,9 +594,15 @@ public void testTableDistribution() {
.withColumns(icebergColumns.toArray(new IcebergColumn[0]))
.withComment("test_table2")
.build();
Assertions.assertDoesNotThrow(() -> newTable.transformDistribution(Distributions.NONE));
Assertions.assertDoesNotThrow(() -> newTable.transformDistribution(Distributions.HASH));
Assertions.assertDoesNotThrow(() -> newTable.transformDistribution(Distributions.RANGE));
String distributionName =
Assertions.assertDoesNotThrow(() -> newTable.transformDistribution(Distributions.NONE));
Assertions.assertEquals(distributionName, DistributionMode.NONE.modeName());
distributionName =
Assertions.assertDoesNotThrow(() -> newTable.transformDistribution(Distributions.HASH));
Assertions.assertEquals(distributionName, DistributionMode.HASH.modeName());
distributionName =
Assertions.assertDoesNotThrow(() -> newTable.transformDistribution(Distributions.RANGE));
Assertions.assertEquals(distributionName, DistributionMode.RANGE.modeName());
}

protected static String genRandomName() {
Expand Down

0 comments on commit c9df667

Please sign in to comment.