Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
import static org.apache.iceberg.TableProperties.WRITE_TARGET_FILE_SIZE_BYTES;
import static org.apache.iceberg.TableProperties.WRITE_TARGET_FILE_SIZE_BYTES_DEFAULT;

class SparkWrite {
public class SparkWrite {
private static final Logger LOG = LoggerFactory.getLogger(SparkWrite.class);

private final JavaSparkContext sparkContext;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
import org.apache.spark.sql.types.StructType;
import org.apache.spark.sql.util.CaseInsensitiveStringMap;

class SparkWriteBuilder implements WriteBuilder, SupportsDynamicOverwrite, SupportsOverwrite {
public class SparkWriteBuilder implements WriteBuilder, SupportsDynamicOverwrite, SupportsOverwrite {

private final SparkSession spark;
private final Table table;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,32 @@ public void testReadStreamWithSnapshotTypeReplaceIgnoresReplace() throws Excepti
Assertions.assertThat(actual).containsExactlyInAnyOrderElementsOf(Iterables.concat(expected));
}

@SuppressWarnings("unchecked")
@Test
public void testReadStreamWithSnapshotTypeReplaceAndSkipReplaceOption() throws Exception {
// fill table with some data
List<List<SimpleRecord>> dataAcrossSnapshots = TEST_DATA_MULTIPLE_SNAPSHOTS;
appendDataAsMultipleSnapshots(dataAcrossSnapshots, tableIdentifier);

table.refresh();

// this should create a snapshot with type Replace.
table.rewriteManifests()
.clusterBy(f -> 1)
.commit();

// check pre-condition
Assert.assertEquals(DataOperations.REPLACE, table.currentSnapshot().operation());

Dataset<Row> df = spark.readStream()
.format("iceberg")
.option(SparkReadOptions.READ_STREAM_SKIP_REPLACE, "true")
.load(tableIdentifier);

Assertions.assertThat(processAvailable(df))
.containsExactlyInAnyOrderElementsOf(Iterables.concat(dataAcrossSnapshots));
}

@SuppressWarnings("unchecked")

@SreeramGarlapati SreeramGarlapati Jul 19, 2021

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this lookslike as if this is a new change. I guess your master is not up to date.

@Test
public void testReadStreamWithSnapshotTypeDeleteErrorsOut() throws Exception {
Expand Down