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 @@ -407,7 +407,6 @@ Properties of the asynchronous materialized view. You can modify the properties

- `PCT`: (Default) For partitioned materialized views, only the affected partition is refreshed when there is a data change, ensuring result consistency for that partition. For non-partitioned materialized views, any data change in the base table triggers a full refresh of the materialized view.
- `INCREMENTAL`: Ensures that only incremental refreshes are performed. If the materialized view does not support incremental refresh based on its definition or encounters non-incremental data, creation or refresh will fail.
- `FULL`: Forces a full refresh of all data every time, regardless of whether the materialized view supports incremental or partition-level refresh.

<MVWarehouse />

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,6 @@ ALTER MATERIALIZED VIEW <mv_name> SET ("bloom_filter_columns" = "");

- `PCT`: (デフォルト)パーティション化されたマテリアライズドビューの場合、ベーステーブルにデータの変更があると影響を受けたパーティションのみリフレッシュされ、そのパーティションの結果の一貫性が保証されます。パーティション化されていないマテリアライズドビューの場合、ベーステーブルのいずれかが変更されるとマテリアライズドビュー全体がフルリフレッシュされます。
- `INCREMENTAL`: 増分リフレッシュのみを行うことを保証します。マテリアライズドビューの定義で増分リフレッシュがサポートされていない場合や、非増分データに遭遇した場合、作成やリフレッシュが失敗します。
- `FULL`: マテリアライズドビューが増分やパーティション単位のリフレッシュをサポートしているかどうかに関係なく、毎回全データのフルリフレッシュを強制します。

<MVWarehouse />

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,6 @@ ALTER MATERIALIZED VIEW <mv_name> SET ("bloom_filter_columns" = "");

- `PCT`:(默认)对于分区物化视图,当基表数据发生变化时,仅刷新受影响的分区,保证该分区的数据一致性。对于非分区物化视图,基表任何数据变化都会触发全量刷新。
- `INCREMENTAL`:仅允许进行增量刷新。如果根据定义物化视图不支持增量刷新,或遇到无法增量处理的数据,则创建或刷新的操作会失败。
- `FULL`:每次都强制进行全量刷新,无论物化视图是否支持增量刷新或分区级刷新。

<MVWarehouse />

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,10 +197,6 @@ public enum RefreshMode {
* the last refresh.
*/
PCT,
/**
* FULL: Full refresh mode, refresh all partitions of the materialized view.
*/
FULL,
/**
* INCREMENTAL: Incremental refresh mode, only refresh the incremental changed rows since the last refresh.
*/
Expand All @@ -218,10 +214,6 @@ public boolean isIncremental() {
return this == INCREMENTAL;
}

public boolean isFull() {
return this == FULL;
}

public boolean isIncrementalOrAuto() {
return this == INCREMENTAL || this == AUTO;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -708,7 +708,7 @@ protected void refreshExternalTable(Map<BaseTableSnapshotInfo, PCellSortedSet> b
if (currentRefreshMode.isIncremental()) {
throw new SemanticException("Materialized view %s.%s refresh failed: base table %s schema " +
"or identity changed, cannot do incremental refresh in %s mode. " +
"Please trigger a full refresh.",
"Please drop and re-create the materialized view.",
db.getFullName(), mv.getName(), baseTableInfo.getTableInfoStr(), currentRefreshMode);
}
toRepairTables.add(Pair.create(newTable, baseTableInfo));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,10 @@
import com.starrocks.catalog.MaterializedView;
import com.starrocks.metric.IMaterializedViewMetricsEntity;
import com.starrocks.scheduler.MvTaskRunContext;
import com.starrocks.scheduler.TaskRun;
import com.starrocks.scheduler.mv.hybrid.MVHybridRefreshProcessor;
import com.starrocks.scheduler.mv.ivm.MVIVMRefreshProcessor;
import com.starrocks.scheduler.mv.pct.MVPCTRefreshProcessor;

import java.util.Map;

public class MVRefreshProcessorFactory {
public static final MVRefreshProcessorFactory INSTANCE = new MVRefreshProcessorFactory();

Expand All @@ -37,12 +34,6 @@ public MVRefreshProcessor newProcessor(Database db, MaterializedView mv,
return new MVIVMRefreshProcessor(db, mv, mvContext, mvEntity, refreshMode);
case AUTO:
return new MVHybridRefreshProcessor(db, mv, mvContext, mvEntity, refreshMode);
case FULL: {
// full refresh
Map<String, String> props = mvContext.getProperties();
props.put(TaskRun.FORCE, "true");
return new MVPCTRefreshProcessor(db, mv, mvContext, mvEntity, refreshMode);
}
default:
return new MVPCTRefreshProcessor(db, mv, mvContext, mvEntity, refreshMode);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -447,9 +447,9 @@ public void testVisitModifyTablePropertiesClausePartitionRefreshStrategyNormalCa

@Test
public void testVisitModifyTablePropertiesClauseMvRefreshModeNormalCase() throws Exception {
// Test PROPERTIES_MV_REFRESH_MODE - valid values: AUTO, PCT, FULL, INCREMENTAL
// Use FULL as it doesn't have additional constraints like AUTO/INCREMENTAL
testPropertyNormalCase(PropertyAnalyzer.PROPERTIES_MV_REFRESH_MODE, "FULL");
// Test PROPERTIES_MV_REFRESH_MODE - valid values: AUTO, PCT, INCREMENTAL
// Use PCT as it doesn't have additional constraints like AUTO/INCREMENTAL
testPropertyNormalCase(PropertyAnalyzer.PROPERTIES_MV_REFRESH_MODE, "PCT");
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,6 @@ public void testChangeMVRefreshMode1() throws Exception {
alterMaterializedView(alterStmt, false);
Assertions.assertEquals(MaterializedView.RefreshMode.AUTO, mv.getCurrentRefreshMode());
}
// change refresh mode from auto to full
{
String alterStmt = "alter materialized view test_mv1 set (\"refresh_mode\" = \"full\")";
alterMaterializedView(alterStmt, false);
Assertions.assertEquals(MaterializedView.RefreshMode.FULL, mv.getCurrentRefreshMode());
}
}

@Test
Expand All @@ -90,12 +84,6 @@ public void testChangeMVRefreshMode2() throws Exception {
alterMaterializedView(alterStmt, true);
Assertions.assertEquals(MaterializedView.RefreshMode.PCT, mv.getCurrentRefreshMode());
}
// change refresh mode to full
{
String alterStmt = "alter materialized view test_mv1 set (\"refresh_mode\" = \"full\")";
alterMaterializedView(alterStmt, false);
Assertions.assertEquals(MaterializedView.RefreshMode.FULL, mv.getCurrentRefreshMode());
}
}

@Test
Expand All @@ -116,64 +104,6 @@ public void testChangeMVRefreshMode3() throws Exception {
alterMaterializedView(alterStmt, false);
Assertions.assertEquals(MaterializedView.RefreshMode.AUTO, mv.getCurrentRefreshMode());
}
// change refresh mode from auto to full
{
String alterStmt = "alter materialized view test_mv1 set (\"refresh_mode\" = \"full\")";
alterMaterializedView(alterStmt, false);
Assertions.assertEquals(MaterializedView.RefreshMode.FULL, mv.getCurrentRefreshMode());
}
}

@Test
public void testChangeMVRefreshMode4() throws Exception {
String query = "SELECT id, data, date FROM `iceberg0`.`unpartitioned_db`.`t0` as a;";
MaterializedView mv = createMaterializedViewWithRefreshMode(query, "full");
Assertions.assertEquals(MaterializedView.RefreshMode.FULL, mv.getCurrentRefreshMode());

// change refresh mode from auto to incremental
{
String alterStmt = "alter materialized view test_mv1 set (\"refresh_mode\" = \"incremental\")";
alterMaterializedView(alterStmt, true);
Assertions.assertEquals(MaterializedView.RefreshMode.FULL, mv.getCurrentRefreshMode());
}
// change refresh mode from incremental to auto
{
String alterStmt = "alter materialized view test_mv1 set (\"refresh_mode\" = \"auto\")";
alterMaterializedView(alterStmt, true);
Assertions.assertEquals(MaterializedView.RefreshMode.FULL, mv.getCurrentRefreshMode());
}
// change refresh mode from auto to full
{
String alterStmt = "alter materialized view test_mv1 set (\"refresh_mode\" = \"full\")";
alterMaterializedView(alterStmt, false);
Assertions.assertEquals(MaterializedView.RefreshMode.FULL, mv.getCurrentRefreshMode());
}
}

@Test
public void testChangeMVRefreshMode5() throws Exception {
String query = "SELECT id, count(data) over (partition by date) FROM `iceberg0`.`unpartitioned_db`.`t0` as a;";
MaterializedView mv = createMaterializedViewWithRefreshMode(query, "full");
Assertions.assertEquals(MaterializedView.RefreshMode.FULL, mv.getCurrentRefreshMode());

// change refresh mode from auto to incremental
{
String alterStmt = "alter materialized view test_mv1 set (\"refresh_mode\" = \"incremental\")";
alterMaterializedView(alterStmt, true);
Assertions.assertEquals(MaterializedView.RefreshMode.FULL, mv.getCurrentRefreshMode());
}
// change refresh mode to auto
{
String alterStmt = "alter materialized view test_mv1 set (\"refresh_mode\" = \"auto\")";
alterMaterializedView(alterStmt, true);
Assertions.assertEquals(MaterializedView.RefreshMode.FULL, mv.getCurrentRefreshMode());
}
// change refresh mode to full
{
String alterStmt = "alter materialized view test_mv1 set (\"refresh_mode\" = \"full\")";
alterMaterializedView(alterStmt, false);
Assertions.assertEquals(MaterializedView.RefreshMode.FULL, mv.getCurrentRefreshMode());
}
}

@Test
Expand All @@ -194,12 +124,6 @@ public void testChangeMVRefreshMode6() throws Exception {
alterMaterializedView(alterStmt, true);
Assertions.assertEquals(MaterializedView.RefreshMode.PCT, mv.getCurrentRefreshMode());
}
// change refresh mode from auto to full
{
String alterStmt = "alter materialized view test_mv1 set (\"refresh_mode\" = \"full\")";
alterMaterializedView(alterStmt, false);
Assertions.assertEquals(MaterializedView.RefreshMode.FULL, mv.getCurrentRefreshMode());
}
}

@Test
Expand All @@ -220,12 +144,6 @@ public void testChangeMVRefreshMode7() throws Exception {
alterMaterializedView(alterStmt, true);
Assertions.assertEquals(MaterializedView.RefreshMode.PCT, mv.getCurrentRefreshMode());
}
// change refresh mode to full
{
String alterStmt = "alter materialized view test_mv1 set (\"refresh_mode\" = \"full\")";
alterMaterializedView(alterStmt, false);
Assertions.assertEquals(MaterializedView.RefreshMode.FULL, mv.getCurrentRefreshMode());
}
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -419,20 +419,6 @@ public void testIncrementalRefreshWithScanOperator() throws Exception {
Assertions.assertEquals(MaterializedView.RefreshMode.INCREMENTAL, mv.getCurrentRefreshMode());
}

@Test
public void testFullRefreshWithScanOperator() throws Exception {
String query = "SELECT id, data, date FROM `iceberg0`.`unpartitioned_db`.`t0` as a;";
MaterializedView mv = createMaterializedViewWithRefreshMode(query, "full");
Assertions.assertEquals(MaterializedView.RefreshMode.FULL, mv.getCurrentRefreshMode());
}

@Test
public void testFullRefreshWithTableFunctionOperator() throws Exception {
String query = "SELECT id, unnest FROM `iceberg0`.`unpartitioned_db`.`t0` as a, unnest(split(data, ','));";
MaterializedView mv = createMaterializedViewWithRefreshMode(query, "full");
Assertions.assertEquals(MaterializedView.RefreshMode.FULL, mv.getCurrentRefreshMode());
}

@Test
public void testAutoRefreshWithScanOperator() throws Exception {
String query = "SELECT id, data, date FROM `iceberg0`.`unpartitioned_db`.`t0` as a;";
Expand All @@ -448,13 +434,6 @@ public void testIncrementalRefreshWithOlapScanOperator() throws Exception {
});
}

@Test
public void testFullRefreshWithOlapScanOperator() throws Exception {
String query = "SELECT * from emps;";
MaterializedView mv = createMaterializedViewWithRefreshMode(query, "full");
Assertions.assertEquals(MaterializedView.RefreshMode.FULL, mv.getCurrentRefreshMode());
}

@Test
public void testAutoRefreshWithOlapScanOperator() throws Exception {
String query = "SELECT * from emps;";
Expand Down
Loading
Loading