Search in sources :

Example 6 with DistributionMode

use of org.apache.iceberg.DistributionMode in project iceberg by apache.

the class TestSparkDistributionAndOrderingUtil method checkCopyOnWriteDistributionAndOrdering.

private void checkCopyOnWriteDistributionAndOrdering(Table table, Command command, Distribution expectedDistribution, SortOrder[] expectedOrdering) {
    SparkWriteConf writeConf = new SparkWriteConf(spark, table, ImmutableMap.of());
    DistributionMode mode = copyOnWriteDistributionMode(command, writeConf);
    Distribution distribution = SparkDistributionAndOrderingUtil.buildCopyOnWriteDistribution(table, command, mode);
    Assert.assertEquals("Distribution must match", expectedDistribution, distribution);
    SortOrder[] ordering = SparkDistributionAndOrderingUtil.buildCopyOnWriteOrdering(table, command, distribution);
    Assert.assertArrayEquals("Ordering must match", expectedOrdering, ordering);
}
Also used : Distribution(org.apache.spark.sql.connector.distributions.Distribution) DistributionMode(org.apache.iceberg.DistributionMode) SortOrder(org.apache.spark.sql.connector.expressions.SortOrder)

Example 7 with DistributionMode

use of org.apache.iceberg.DistributionMode in project iceberg by apache.

the class TestSparkDistributionAndOrderingUtil method checkWriteDistributionAndOrdering.

private void checkWriteDistributionAndOrdering(Table table, Distribution expectedDistribution, SortOrder[] expectedOrdering) {
    SparkWriteConf writeConf = new SparkWriteConf(spark, table, ImmutableMap.of());
    DistributionMode distributionMode = writeConf.distributionMode();
    Distribution distribution = SparkDistributionAndOrderingUtil.buildRequiredDistribution(table, distributionMode);
    Assert.assertEquals("Distribution must match", expectedDistribution, distribution);
    SortOrder[] ordering = SparkDistributionAndOrderingUtil.buildRequiredOrdering(table, distribution);
    Assert.assertArrayEquals("Ordering must match", expectedOrdering, ordering);
}
Also used : Distribution(org.apache.spark.sql.connector.distributions.Distribution) DistributionMode(org.apache.iceberg.DistributionMode) SortOrder(org.apache.spark.sql.connector.expressions.SortOrder)

Example 8 with DistributionMode

use of org.apache.iceberg.DistributionMode in project iceberg by apache.

the class TestSparkDistributionAndOrderingUtil method checkPositionDeltaDistributionAndOrdering.

private void checkPositionDeltaDistributionAndOrdering(Table table, Command command, Distribution expectedDistribution, SortOrder[] expectedOrdering) {
    SparkWriteConf writeConf = new SparkWriteConf(spark, table, ImmutableMap.of());
    DistributionMode mode = positionDeltaDistributionMode(command, writeConf);
    Distribution distribution = SparkDistributionAndOrderingUtil.buildPositionDeltaDistribution(table, command, mode);
    Assert.assertEquals("Distribution must match", expectedDistribution, distribution);
    SortOrder[] ordering = SparkDistributionAndOrderingUtil.buildPositionDeltaOrdering(table, command);
    Assert.assertArrayEquals("Ordering must match", expectedOrdering, ordering);
}
Also used : Distribution(org.apache.spark.sql.connector.distributions.Distribution) DistributionMode(org.apache.iceberg.DistributionMode) SortOrder(org.apache.spark.sql.connector.expressions.SortOrder)

Aggregations

DistributionMode (org.apache.iceberg.DistributionMode)8 Test (org.junit.Test)5 Distribution (org.apache.spark.sql.connector.distributions.Distribution)3 SortOrder (org.apache.spark.sql.connector.expressions.SortOrder)3