This is an automated email from the ASF dual-hosted git repository.
lijibing pushed a commit to branch branch-2.1
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-2.1 by this push:
new cb40a0bee3a branch-2.1: [test](statistics)Add stats test for replace
table. #44011 (#44212)
cb40a0bee3a is described below
commit cb40a0bee3a5a4acf2077e986a5c51e1c610a4dc
Author: github-actions[bot]
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Tue Nov 19 07:57:13 2024 +0800
branch-2.1: [test](statistics)Add stats test for replace table. #44011
(#44212)
Cherry-picked from #44011
Co-authored-by: James <[email protected]>
---
.../suites/statistics/test_replace_table.grovvy | 81 ++++++++++++++++++++++
1 file changed, 81 insertions(+)
diff --git a/regression-test/suites/statistics/test_replace_table.grovvy
b/regression-test/suites/statistics/test_replace_table.grovvy
new file mode 100644
index 00000000000..08c68c5ac20
--- /dev/null
+++ b/regression-test/suites/statistics/test_replace_table.grovvy
@@ -0,0 +1,81 @@
+// 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_replace_table") {
+
+ sql """drop database if exists test_replace_table"""
+ sql """create database test_replace_table"""
+ sql """use test_replace_table"""
+ sql """set global force_sample_analyze=false"""
+ sql """set global enable_auto_analyze=false"""
+
+ sql """CREATE TABLE t1 (
+ t1key int NOT NULL,
+ t1value varchar(25) NOT NULL
+ )ENGINE=OLAP
+ DUPLICATE KEY(`t1key`)
+ COMMENT "OLAP"
+ DISTRIBUTED BY HASH(`t1key`) BUCKETS 1
+ PROPERTIES (
+ "replication_num" = "1"
+ )
+ """
+
+ sql """CREATE TABLE t2 (
+ t2key int NOT NULL
+ )ENGINE=OLAP
+ DUPLICATE KEY(`t2key`)
+ COMMENT "OLAP"
+ DISTRIBUTED BY HASH(`t2key`) BUCKETS 1
+ PROPERTIES (
+ "replication_num" = "1"
+ )
+ """
+
+ sql """insert into t1 values (1, "1"), (2, "2")"""
+ sql """insert into t2 values (3)"""
+ sql """analyze table t1 with sync"""
+ sql """analyze table t2 with sync"""
+
+ def result = sql """show column stats t1"""
+ assertEquals(2, result.size())
+ result = sql """show column cached stats t1"""
+ assertEquals(2, result.size())
+ result = sql """show column stats t2"""
+ assertEquals(1, result.size())
+ result = sql """show column cached stats t2"""
+ assertEquals(1, result.size())
+
+ sql """ALTER TABLE t1 REPLACE WITH TABLE t2;"""
+ result = sql """show column stats t1"""
+ assertEquals(1, result.size())
+ result = sql """show column cached stats t1"""
+ assertEquals(1, result.size())
+ result = sql """show column stats t2"""
+ assertEquals(2, result.size())
+ result = sql """show column cached stats t2"""
+ assertEquals(2, result.size())
+
+ sql """ALTER TABLE t1 REPLACE WITH TABLE t2 PROPERTIES('swap' =
'false');"""
+ result = sql """show column stats t1"""
+ assertEquals(2, result.size())
+ result = sql """show column cached stats t1"""
+ assertEquals(2, result.size())
+
+ sql """drop database if exists test_replace_table"""
+}
+
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]