diff --git a/core/trino-main/src/main/java/io/trino/testing/TestingMetadata.java b/core/trino-main/src/main/java/io/trino/testing/TestingMetadata.java index f4c74af43983..46320df3c19d 100644 --- a/core/trino-main/src/main/java/io/trino/testing/TestingMetadata.java +++ b/core/trino-main/src/main/java/io/trino/testing/TestingMetadata.java @@ -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; @@ -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) diff --git a/core/trino-main/src/test/java/io/trino/connector/MockConnector.java b/core/trino-main/src/test/java/io/trino/connector/MockConnector.java index 4cef8fcbbb9f..4c6f7b0d6194 100644 --- a/core/trino-main/src/test/java/io/trino/connector/MockConnector.java +++ b/core/trino-main/src/test/java/io/trino/connector/MockConnector.java @@ -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; @@ -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 diff --git a/core/trino-spi/src/main/java/io/trino/spi/connector/MaterializedViewFreshness.java b/core/trino-spi/src/main/java/io/trino/spi/connector/MaterializedViewFreshness.java index f9d2177aa26a..ce120d660b21 100644 --- a/core/trino-spi/src/main/java/io/trino/spi/connector/MaterializedViewFreshness.java +++ b/core/trino-spi/src/main/java/io/trino/spi/connector/MaterializedViewFreshness.java @@ -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");