| // 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_upgrade_downgrade_prepare_stats","p0,stats,restart_fe") { |
| |
| String db = context.config.getDbNameByFile(context.file) |
| sql "use ${db}" |
| |
| sql """ |
| drop table if exists orders_stats |
| """ |
| |
| sql """CREATE TABLE `orders_stats` ( |
| `o_orderkey` BIGINT NULL, |
| `o_custkey` INT NULL, |
| `o_orderstatus` VARCHAR(1) NULL, |
| `o_totalprice` DECIMAL(15, 2) NULL, |
| `o_orderpriority` VARCHAR(15) NULL, |
| `o_clerk` VARCHAR(15) NULL, |
| `o_shippriority` INT NULL, |
| `o_comment` VARCHAR(79) NULL, |
| `o_orderdate` DATE not NULL |
| ) ENGINE=OLAP |
| DUPLICATE KEY(`o_orderkey`, `o_custkey`) |
| COMMENT 'OLAP' |
| DISTRIBUTED BY HASH(`o_orderkey`) BUCKETS 96 |
| PROPERTIES ( |
| "replication_allocation" = "tag.location.default: 1" |
| );""" |
| |
| sql """ |
| insert into orders_stats values |
| (null, 1, 'k', 99.5, 'a', 'b', 1, 'yy', '2023-10-17'), |
| (1, null, 'o', 109.2, 'c','d',2, 'mm', '2023-10-17'), |
| (3, 3, null, 99.5, 'a', 'b', 1, 'yy', '2023-10-19'), |
| (1, 2, 'o', null, 'a', 'b', 1, 'yy', '2023-10-20'), |
| (2, 3, 'k', 109.2, null,'d',2, 'mm', '2023-10-21'), |
| (3, 1, 'k', 99.5, 'a', null, 1, 'yy', '2023-10-22'), |
| (1, 3, 'o', 99.5, 'a', 'b', null, 'yy', '2023-10-19'), |
| (2, 1, 'o', 109.2, 'c','d',2, null, '2023-10-18'), |
| (3, 2, 'k', 99.5, 'a', 'b', 1, 'yy', '2023-10-17'), |
| (4, 5, 'k', 99.5, 'a', 'b', 1, 'yy', '2023-10-19'); |
| """ |
| |
| sql """analyze table orders_stats with sync""" |
| |
| def tb_stats = sql """show table stats orders_stats;""" |
| assertTrue(tb_stats.size() == 1) |
| |
| def col_stats = sql """show column stats orders_stats;""" |
| assertTrue(col_stats.size() == 9) |
| } |