Skip to content
Draft
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 @@ -23,6 +23,7 @@
import org.apache.iceberg.DataFile;
import org.apache.iceberg.DeleteFile;
import org.apache.iceberg.ManifestFile;
import org.apache.iceberg.ManifestListFile;
import org.apache.iceberg.io.BulkDeletionFailureException;
import org.apache.iceberg.io.InputFile;
import org.apache.iceberg.io.OutputFile;
Expand Down Expand Up @@ -149,6 +150,12 @@ public InputFile newInputFile(DeleteFile file)
return SupportsBulkOperations.super.newInputFile(file);
}

@Override
public InputFile newInputFile(ManifestListFile manifestList)
{
return SupportsBulkOperations.super.newInputFile(manifestList);
}

private void deleteBatch(List<String> filesToDelete)
{
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7550,6 +7550,77 @@ public void testReadFromVersionedTableWithExpiredHistory()
assertQueryFails("SELECT * FROM " + tableName + " FOR TIMESTAMP AS OF " + timestampLiteral(v1EpochMillis, 9), "No version history table .* at or before .*");
}

@Test
public void testTimeTravelWithFilterOnRenamedColumn()
{
testTimeTravelWithFilterOnRenamedColumn(false);
testTimeTravelWithFilterOnRenamedColumn(true);
}

private void testTimeTravelWithFilterOnRenamedColumn(boolean partitioned)
{
String partition = partitioned ? "WITH (partitioning = ARRAY['part'])" : "";
try (TestTable table = newTrinoTable("time_travel_with_filter_on_rename_", "(x int, y int, part int)" + partition)) {
assertUpdate("INSERT INTO " + table.getName() + " VALUES (1, 1, 1), (1, 2, 2), (2, 2, 2)", 3);
assertThat(query("SELECT * FROM " + table.getName()))
.matches("VALUES (1, 1, 1), (1, 2, 2), (2, 2, 2)");
long firstSnapshotId = getCurrentSnapshotId(table.getName());

assertUpdate("ALTER TABLE " + table.getName() + " RENAME COLUMN x TO renamed_x");

// generate a new version
assertUpdate("INSERT INTO " + table.getName() + " VALUES (1, 2, 3)", 1);

assertThat(query("SELECT * FROM " + table.getName() + " FOR VERSION AS OF " + firstSnapshotId + " WHERE x = 1"))
.matches("VALUES (1, 1, 1), (1, 2, 2)");
}
}

@Test
public void testTimeTravelWithFilterOnDroppedColumn()
{
testTimeTravelWithFilterOnDroppedColumn(false);
testTimeTravelWithFilterOnDroppedColumn(true);
}

private void testTimeTravelWithFilterOnDroppedColumn(boolean partitioned)
{
String partition = partitioned ? "WITH (partitioning = ARRAY['part'])" : "";
try (TestTable table = newTrinoTable("time_travel_with_filter_on_drop_", "(x int, y int, part int)" + partition)) {
assertUpdate("INSERT INTO " + table.getName() + " VALUES (1, 1, 1), (1, 2, 2), (2, 2, 2)", 3);
assertThat(query("SELECT * FROM " + table.getName()))
.matches("VALUES (1, 1, 1), (1, 2, 2), (2, 2, 2)");
long firstSnapshotId = getCurrentSnapshotId(table.getName());

assertUpdate("ALTER TABLE " + table.getName() + " DROP COLUMN x");

// generate a new version
assertUpdate("INSERT INTO " + table.getName() + " VALUES (1, 2)", 1);

assertThat(query("SELECT * FROM " + table.getName() + " FOR VERSION AS OF " + firstSnapshotId + " WHERE x = 1"))
.matches("VALUES (1, 1, 1), (1, 2, 2)");
}
}

@Test
public void testTimeTravelWithFilterOnRenamedPartitionColumn()
{
try (TestTable table = newTrinoTable("time_travel_with_filter_on_drop_", "(x int, part1 int, part2 int) WITH (partitioning = ARRAY['part1', 'part2'])")) {
assertUpdate("INSERT INTO " + table.getName() + " VALUES (1, 1, 1), (1, 1, 2), (2, 2, 2)", 3);
assertThat(query("SELECT * FROM " + table.getName()))
.matches("VALUES (1, 1, 1), (1, 1, 2), (2, 2, 2)");
long firstSnapshotId = getCurrentSnapshotId(table.getName());

assertUpdate("ALTER TABLE " + table.getName() + " RENAME COLUMN part1 TO renamed_part");

// generate a new version
assertUpdate("INSERT INTO " + table.getName() + " VALUES (1, 1, 3)", 1);

assertThat(query("SELECT * FROM " + table.getName() + " FOR VERSION AS OF " + firstSnapshotId + " WHERE part1 = 1"))
.matches("VALUES (1, 1, 1), (1, 1, 2)");
}
}

@Test
public void testDeleteRetainsTableHistory()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import org.apache.iceberg.relocated.com.google.common.collect.ImmutableMap;
import org.apache.iceberg.relocated.com.google.common.io.CharStreams;
import org.apache.iceberg.rest.HTTPRequest.HTTPMethod;
import org.apache.iceberg.rest.RESTCatalogAdapter.Route;
import org.apache.iceberg.rest.responses.ErrorResponse;
import org.apache.iceberg.util.Pair;

Expand Down
9 changes: 8 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@
<dep.frontend-npm.version>11.2.0</dep.frontend-npm.version>
<dep.gib.version>4.5.6</dep.gib.version>
<dep.httpcore5.version>5.3.6</dep.httpcore5.version>
<dep.iceberg.version>1.10.0</dep.iceberg.version>
<dep.iceberg.version>1.11.0-SNAPSHOT</dep.iceberg.version>
<dep.jna.version>5.18.1</dep.jna.version>
<dep.jsonwebtoken.version>0.13.0</dep.jsonwebtoken.version>
<dep.jts.version>1.20.0</dep.jts.version>
Expand Down Expand Up @@ -2440,6 +2440,13 @@
</dependencies>
</dependencyManagement>

<repositories>
<repository>
<id>apache-snapshots</id>
<url>https://repository.apache.org/content/repositories/snapshots</url>
</repository>
</repositories>

<build>
<pluginManagement>
<plugins>
Expand Down
Loading