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 @@ -970,6 +970,7 @@ public Optional<ConnectorOutputMetadata> finishRefreshMaterializedView(
.map(handle -> (IcebergTableHandle) handle)
.filter(handle -> handle.getSnapshotId().isPresent())
.map(handle -> handle.getSchemaTableName() + "=" + handle.getSnapshotId().get())
.distinct()
.collect(joining(","));

// Update the 'dependsOnTables' property that tracks tables on which the materialized view depends and the corresponding snapshot ids of the tables
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,20 @@ public void testCreateWithInvalidPropertyFails()
.hasMessage("Catalog 'iceberg' does not support materialized view property 'invalid_property'");
}

@Test
public void testCreateWithDuplicateSourceTableSucceeds()
{
assertUpdate("" +
"CREATE MATERIALIZED VIEW materialized_view_with_duplicate_source AS " +
"SELECT _bigint, _date FROM base_table1 " +
"UNION ALL " +
"SELECT _bigint, _date FROM base_table1 ");

assertUpdate("REFRESH MATERIALIZED VIEW materialized_view_with_duplicate_source", 12);

assertQuery("SELECT count(*) FROM materialized_view_with_duplicate_source", "VALUES 12");
}

@Test
public void testShowCreate()
{
Expand Down