-
Notifications
You must be signed in to change notification settings - Fork 411
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add integration test for div_precision_increment support (#8846)
ref #8834
- Loading branch information
Showing
1 changed file
with
58 additions
and
0 deletions.
There are no files selected for viewing
58 changes: 58 additions & 0 deletions
58
tests/fullstack-test2/variables/set_variable_div_precision_increment.test
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,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 |