Skip to content

Commit

Permalink
Add integration test for div_precision_increment support (#8846)
Browse files Browse the repository at this point in the history
ref #8834
  • Loading branch information
yibin87 authored Mar 15, 2024
1 parent d2a6642 commit 0d13f39
Showing 1 changed file with 58 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Copyright 2024 PingCAP, Inc.
#
# Licensed 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.

## test correctness in simple case
mysql> drop table if exists test.t
mysql> create table test.t (a decimal(3, 1), b decimal(3, 0))
mysql> alter table test.t set tiflash replica 1

func> wait_table test t

mysql> insert into test.t values(11.2,3);
mysql> insert into test.t values(10.1,3);
mysql> insert into test.t values(13.7,3);

mysql> set session tidb_isolation_read_engines='tiflash'; set tidb_enforce_mpp = 1; select a/b from test.t;
+---------+
| a/b |
+---------+
| 3.73333 |
| 3.36667 |
| 4.56667 |
+---------+

mysql> set session tidb_isolation_read_engines='tiflash'; set tidb_enforce_mpp = 1; select avg(a) from test.t group by b;
+----------+
| avg(a) |
+----------+
| 11.66667 |
+----------+

mysql> set session tidb_isolation_read_engines='tiflash'; set tidb_enforce_mpp = 1; set div_precision_increment = 5; select a/b from test.t;
+----------+
| a/b |
+----------+
| 3.733333 |
| 3.366667 |
| 4.566667 |
+----------+

mysql> set session tidb_isolation_read_engines='tiflash'; set tidb_enforce_mpp = 1; set div_precision_increment = 5; select avg(a) from test.t group by b;
+-----------+
| avg(a) |
+-----------+
| 11.666667 |
+-----------+

mysql> drop table if exists test.t

0 comments on commit 0d13f39

Please sign in to comment.