# 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. # Preparation. mysql> drop table if exists test.t1 mysql> drop table if exists test.t2 mysql> create table test.t1 (pk int(11) NOT NULL AUTO_INCREMENT,col_int int(11) DEFAULT NULL,col_varchar_1024_latin1 varchar(1024) CHARACTER SET latin1 COLLATE latin1_bin DEFAULT NULL, col_int_key int(11) DEFAULT NULL, PRIMARY KEY (pk) /*T![clustered_index] CLUSTERED */, KEY col_int_key (col_int_key)); mysql> create table test.t2 (pk int(11) NOT NULL AUTO_INCREMENT,col_varchar_10_latin1_key varchar(10) CHARACTER SET latin1 COLLATE latin1_bin DEFAULT NULL,PRIMARY KEY (pk) /*T![clustered_index] CLUSTERED */,KEY col_varchar_10_latin1_key (col_varchar_10_latin1_key)); mysql> insert into test.t1 values(1,2,3,4); mysql> insert into test.t2 values(1,3); mysql> alter table test.t1 set tiflash replica 1; mysql> alter table test.t2 set tiflash replica 1; func> wait_table test t1 func> wait_table test t2 mysql> use test; set session tidb_allow_mpp=on; SELECT table1.col_int_key AS field1 , table1.pk AS field2 , SUM( table1.pk ) AS field3 FROM t1 AS table1 RIGHT OUTER JOIN t2 AS table2 ON table1.col_varchar_1024_latin1 = table2.col_varchar_10_latin1_key WHERE table1.col_int_key != table1.col_int GROUP BY field1, field2; +--------+--------+--------+ | field1 | field2 | field3 | +--------+--------+--------+ | 4 | 1 | 1 | +--------+--------+--------+ # Clean up. mysql> drop table if exists test.t1 mysql> drop table if exists test.t2