morrySnow commented on code in PR #37396: URL: https://github.com/apache/doris/pull/37396#discussion_r1682858707
########## regression-test/suites/rollup_p0/test_create_mv_and_mtmv.groovy: ########## @@ -0,0 +1,94 @@ +// 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. + +suite("test_create_mv_and_mtmt") { + def tableName = "test_create_mv_and_mtmt_advertiser_view_record" + def mvName = "test_create_mv_and_mtmt_advertiser_uv" + def mtmvName = "test_create_mv_and_mtmt_advertiser_uv_mtmv" + sql """ + CREATE TABLE ${tableName}( + time date not null, + advertiser varchar(10), + dt date not null, + channel varchar(10), + user_id int) + DUPLICATE KEY(`time`, `advertiser`) + PARTITION BY RANGE (dt)(FROM ("2024-07-02") TO ("2024-07-04") INTERVAL 1 DAY) + -- AUTO PARTITION BY RANGE (date_trunc(`time`, 'day'))() + distributed BY hash(time) + properties("replication_num" = "1"); + """ + sql """ + CREATE materialized VIEW ${mvName} AS + SELECT advertiser, + channel, + dt, + bitmap_union(to_bitmap(user_id)) + FROM ${tableName} + GROUP BY advertiser, + channel, + dt; + + """ + sql """ insert into ${tableName} values("2024-07-02",'a', "2024-07-02", 'a',1); """ + sql """ insert into ${tableName} values("2024-07-03",'b', "2024-07-03", 'b',1); """ + + var tryTimes = 0 Review Comment: maybe u could insert value first and then use createMV function to create mv. it could ensure mv create success -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
