-
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.
Browse files
Browse the repository at this point in the history
ref #6233, close pingcap/tidb#49241
- Loading branch information
1 parent
e4a30bc
commit 3d5c741
Showing
1 changed file
with
80 additions
and
0 deletions.
There are no files selected for viewing
80 changes: 80 additions & 0 deletions
80
tests/fullstack-test/mpp/apply_with_late_materialization.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,80 @@ | ||
# Copyright 2023 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. | ||
|
||
|
||
# https://github.com/pingcap/tidb/issues/49241 | ||
# Preparation. | ||
mysql> drop table if exists test.t; | ||
mysql> drop table if exists test.t1; | ||
mysql> create table test.t(id int, value int); | ||
mysql> create table test.t1(id int, value int); | ||
mysql> insert into test.t values(10,5),(9,5),(8,5),(7,5),(6,5),(5,5),(4,5),(3,5),(2,5),(1,5); | ||
mysql> insert into test.t1 values(2,5); | ||
# insert more than 8192 rows to make sure late materialization is enabled. | ||
mysql> insert into test.t select * from test.t; insert into test.t select * from test.t; insert into test.t select * from test.t; insert into test.t select * from test.t; | ||
mysql> insert into test.t select * from test.t; insert into test.t select * from test.t; insert into test.t select * from test.t; insert into test.t select * from test.t; | ||
mysql> insert into test.t select * from test.t; insert into test.t select * from test.t; insert into test.t select * from test.t; | ||
mysql> alter table test.t set tiflash replica 1; | ||
mysql> alter table test.t1 set tiflash replica 1; | ||
mysql> analyze table test.t; | ||
|
||
func> wait_table test t t1 | ||
|
||
# Test. | ||
|
||
# MPP | ||
mysql> set @@tidb_allow_mpp=1; set @@tidb_opt_enable_late_materialization=1; select (select t.value from test.t where t.id = t1.id order by t.value limit 1) xx from test.t1 order by t1.value limit 5; | ||
+------+ | ||
| xx | | ||
+------+ | ||
| 5 | | ||
+------+ | ||
mysql> set @@tidb_allow_mpp=1; set @@tidb_opt_enable_late_materialization=0; select (select t.value from test.t where t.id = t1.id order by t.value limit 1) xx from test.t1 order by t1.value limit 5; | ||
+------+ | ||
| xx | | ||
+------+ | ||
| 5 | | ||
+------+ | ||
|
||
# BatchCop | ||
mysql> set @@tidb_allow_mpp=0; set @@tidb_allow_batch_cop = 2; set @@tidb_opt_enable_late_materialization=1; select (select t.value from test.t where t.id = t1.id order by t.value limit 1) xx from test.t1 order by t1.value limit 5; | ||
+------+ | ||
| xx | | ||
+------+ | ||
| 5 | | ||
+------+ | ||
mysql> set @@tidb_allow_mpp=0; set @@tidb_allow_batch_cop = 2; set @@tidb_opt_enable_late_materialization=0; select (select t.value from test.t where t.id = t1.id order by t.value limit 1) xx from test.t1 order by t1.value limit 5; | ||
+------+ | ||
| xx | | ||
+------+ | ||
| 5 | | ||
+------+ | ||
|
||
# Cop | ||
mysql> set @@tidb_allow_mpp=0; set @@tidb_allow_batch_cop = 0; set @@tidb_opt_enable_late_materialization=1; select (select t.value from test.t where t.id = t1.id order by t.value limit 1) xx from test.t1 order by t1.value limit 5; | ||
+------+ | ||
| xx | | ||
+------+ | ||
| 5 | | ||
+------+ | ||
mysql> set @@tidb_allow_mpp=0; set @@tidb_allow_batch_cop = 0; set @@tidb_opt_enable_late_materialization=0; select (select t.value from test.t where t.id = t1.id order by t.value limit 1) xx from test.t1 order by t1.value limit 5; | ||
+------+ | ||
| xx | | ||
+------+ | ||
| 5 | | ||
+------+ | ||
|
||
# Clean up. | ||
mysql> drop table if exists test.t; | ||
mysql> drop table if exists test.t1; |