Skip to content
Merged
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 @@ -3928,13 +3928,10 @@ case FirstChangeSnapshot(Snapshot snapshot) -> {
firstTableChange = firstTableChange
.map(epochMilli -> Math.min(epochMilli, snapshot.timestampMillis()));
}
case UnknownTableChange() -> {
case UnknownTableChange(), GoneOrCorruptedTableChange() -> {
hasStaleIcebergTables = true;
firstTableChange = Optional.empty();
}
case CorruptedTableChange() -> {
return new MaterializedViewFreshness(STALE, Optional.empty());
}
}
}

Expand Down Expand Up @@ -3972,7 +3969,7 @@ else if (strings.size() != 2) {

if (tableHandle == null || tableHandle instanceof CorruptedIcebergTableHandle) {
// Base table is gone or table is corrupted
return new CorruptedTableChange();
return new GoneOrCorruptedTableChange();
}
Optional<Long> snapshotAtRefresh;
if (value.isEmpty()) {
Expand Down Expand Up @@ -4098,7 +4095,7 @@ private static IcebergTableHandle checkValidTableHandle(ConnectorTableHandle tab
}

private sealed interface TableChangeInfo
permits NoTableChange, FirstChangeSnapshot, UnknownTableChange, CorruptedTableChange {}
permits NoTableChange, FirstChangeSnapshot, UnknownTableChange, GoneOrCorruptedTableChange {}

private record NoTableChange()
implements TableChangeInfo {}
Expand All @@ -4115,7 +4112,7 @@ private record FirstChangeSnapshot(Snapshot snapshot)
private record UnknownTableChange()
implements TableChangeInfo {}

private record CorruptedTableChange()
private record GoneOrCorruptedTableChange()
implements TableChangeInfo {}

private static TableStatistics getIncrementally(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1801,9 +1801,14 @@ private void testMaterializedViewBaseTableGone(boolean initialized)
assertUpdate("REFRESH MATERIALIZED VIEW " + viewName, 1);
}
assertUpdate("DROP TABLE " + baseTable);
assertQueryFails(
"TABLE " + viewName,
"line 1:1: Failed analyzing stored view '%1$s\\.%2$s\\.%3$s': line 3:3: Table '%1$s\\.%2$s\\.%4$s' does not exist".formatted(catalog, schema, viewName, baseTable));
if (initialized) {
assertQuerySucceeds("TABLE " + viewName);
}
else {
assertQueryFails(
"TABLE " + viewName,
"line 1:1: Failed analyzing stored view '%1$s\\.%2$s\\.%3$s': line 3:3: Table '%1$s\\.%2$s\\.%4$s' does not exist".formatted(catalog, schema, viewName, baseTable));
}
assertUpdate("DROP MATERIALIZED VIEW " + viewName);
}

Expand Down