forked from apache/doris
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[fix](mtmv) Mtmv support set both immediate and starttime (apache#39573)
extends: apache#36805 Previously, if the user set immediate execution, the current time would replace the user's set start time
- Loading branch information
Showing
3 changed files
with
97 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
-- This file is automatically generated. You should know what you did if you want to edit this | ||
-- !init -- | ||
1 1 | ||
2 2 | ||
3 3 | ||
|
||
-- !create -- | ||
EVERY 2 HOUR STARTS 9999-12-13 21:07:09 | ||
|
||
-- !alter -- | ||
EVERY 2 HOUR STARTS 9998-12-13 21:07:09 | ||
|
||
-- !refresh -- | ||
1 1 | ||
2 2 | ||
3 3 | ||
|
76 changes: 76 additions & 0 deletions
76
regression-test/suites/mtmv_p0/test_start_time_mtmv.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
// Licensed to the Apache Software Foundation (ASF) under one | ||
// or more contributor license agreements. See the NOTICE file | ||
// distributed with this work for additional information | ||
// regarding copyright ownership. The ASF licenses this file | ||
// to you under the Apache License, Version 2.0 (the | ||
// "License"); you may not use this file except in compliance | ||
// with the License. You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, | ||
// software distributed under the License is distributed on an | ||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
// KIND, either express or implied. See the License for the | ||
// specific language governing permissions and limitations | ||
// under the License. | ||
|
||
import org.junit.Assert; | ||
|
||
suite("test_start_time_mtmv","mtmv") { | ||
String suiteName = "test_start_time_mtmv" | ||
String tableName = "${suiteName}_table" | ||
String mvName = "${suiteName}_mv" | ||
|
||
sql """drop table if exists `${tableName}`""" | ||
sql """drop materialized view if exists ${mvName};""" | ||
|
||
sql """ | ||
CREATE TABLE ${tableName} | ||
( | ||
k2 INT, | ||
k3 varchar(32) | ||
) | ||
DISTRIBUTED BY HASH(k2) BUCKETS 2 | ||
PROPERTIES ( | ||
"replication_num" = "1" | ||
); | ||
""" | ||
|
||
sql """ | ||
insert into ${tableName} values(1,1),(2,2),(3,3); | ||
""" | ||
|
||
sql """ | ||
CREATE MATERIALIZED VIEW ${mvName} | ||
BUILD immediate REFRESH AUTO ON SCHEDULE EVERY 2 HOUR STARTS "9999-12-13 21:07:09" | ||
DISTRIBUTED BY RANDOM BUCKETS 2 | ||
PROPERTIES ( | ||
'replication_num' = '1' | ||
) | ||
AS | ||
SELECT * from ${tableName}; | ||
""" | ||
|
||
waitingMTMVTaskFinishedByMvName(mvName) | ||
order_qt_init "SELECT * FROM ${mvName}" | ||
|
||
order_qt_create "select RecurringStrategy from jobs('type'='mv') where MvName='${mvName}'" | ||
|
||
sql """ | ||
alter MATERIALIZED VIEW ${mvName} REFRESH auto ON SCHEDULE EVERY 2 HOUR STARTS "9998-12-13 21:07:09"; | ||
""" | ||
|
||
order_qt_alter "select RecurringStrategy from jobs('type'='mv') where MvName='${mvName}'" | ||
|
||
// refresh mv | ||
sql """ | ||
REFRESH MATERIALIZED VIEW ${mvName} complete | ||
""" | ||
|
||
waitingMTMVTaskFinishedByMvName(mvName) | ||
order_qt_refresh "SELECT * FROM ${mvName}" | ||
|
||
sql """drop table if exists `${tableName}`""" | ||
sql """drop materialized view if exists ${mvName};""" | ||
} |