Skip to content

Commit

Permalink
Remove legacy MaterializedViewFreshness constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
findepi committed Jan 26, 2023
1 parent bc7e276 commit 785ae61
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@
import static com.google.common.base.MoreObjects.toStringHelper;
import static com.google.common.base.Preconditions.checkArgument;
import static io.trino.spi.StandardErrorCode.ALREADY_EXISTS;
import static io.trino.spi.connector.MaterializedViewFreshness.Freshness.FRESH;
import static io.trino.spi.connector.MaterializedViewFreshness.Freshness.STALE;
import static java.util.Collections.synchronizedSet;
import static java.util.Objects.requireNonNull;

Expand Down Expand Up @@ -269,7 +271,7 @@ public void dropMaterializedView(ConnectorSession session, SchemaTableName viewN
@Override
public MaterializedViewFreshness getMaterializedViewFreshness(ConnectorSession session, SchemaTableName name)
{
return new MaterializedViewFreshness(freshMaterializedViews.contains(name));
return new MaterializedViewFreshness(freshMaterializedViews.contains(name) ? FRESH : STALE);
}

public void markMaterializedViewIsFresh(SchemaTableName name)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,8 @@
import static com.google.common.collect.ImmutableMap.toImmutableMap;
import static com.google.common.collect.ImmutableSet.toImmutableSet;
import static io.trino.connector.MockConnector.MockConnectorSplit.MOCK_CONNECTOR_SPLIT;
import static io.trino.spi.connector.MaterializedViewFreshness.Freshness.FRESH;
import static io.trino.spi.connector.MaterializedViewFreshness.Freshness.STALE;
import static io.trino.spi.connector.RowChangeParadigm.DELETE_ROW_AND_INSERT_ROW;
import static io.trino.spi.type.BigintType.BIGINT;
import static java.util.Objects.requireNonNull;
Expand Down Expand Up @@ -600,7 +602,7 @@ public MaterializedViewFreshness getMaterializedViewFreshness(ConnectorSession s
{
ConnectorMaterializedViewDefinition view = getMaterializedViews.apply(session, viewName.toSchemaTablePrefix()).get(viewName);
checkArgument(view != null, "Materialized view %s does not exist", viewName);
return new MaterializedViewFreshness(view.getStorageTable().isPresent());
return new MaterializedViewFreshness(view.getStorageTable().isPresent() ? FRESH : STALE);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,12 @@
import java.util.Objects;
import java.util.StringJoiner;

import static io.trino.spi.connector.MaterializedViewFreshness.Freshness.FRESH;
import static io.trino.spi.connector.MaterializedViewFreshness.Freshness.STALE;
import static java.util.Objects.requireNonNull;

public final class MaterializedViewFreshness
{
private final Freshness freshness;

@Deprecated
public MaterializedViewFreshness(boolean materializedViewFresh)
{
this(materializedViewFresh ? FRESH : STALE);
}

public MaterializedViewFreshness(Freshness freshness)
{
this.freshness = requireNonNull(freshness, "freshness is null");
Expand Down

0 comments on commit 785ae61

Please sign in to comment.