# 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. mysql> drop table if exists test.t; mysql> drop table if exists test.t1; mysql> create table test.t(id int, value int, ts timestamp); mysql> set time_zone = 'UTC'; insert into test.t values(1, 10, '2000-01-01 02:00:00'); mysql> alter table test.t set tiflash replica 1; mysql> create table test.t1(id int, value int); mysql> insert into test.t1 values(1, 15); mysql> alter table test.t1 set tiflash replica 1; func> wait_table test t func> wait_table test t1 #Tests duplicate column caused by timezone cast mysql> SET time_zone = '+8:00'; set tidb_enable_chunk_rpc = 0; set session tidb_isolation_read_engines = 'tiflash'; select * from test.t; +------+-------+---------------------+ | id | value | ts | +------+-------+---------------------+ | 1 | 10 | 2000-01-01 10:00:00 | +------+-------+---------------------+ mysql> SET time_zone = '+8:00'; set tidb_enable_chunk_rpc = 1; set session tidb_isolation_read_engines = 'tiflash'; select * from test.t; +------+-------+---------------------+ | id | value | ts | +------+-------+---------------------+ | 1 | 10 | 2000-01-01 10:00:00 | +------+-------+---------------------+ mysql> SET time_zone = '+0:00'; set tidb_enable_chunk_rpc = 0; set session tidb_isolation_read_engines = 'tiflash'; select * from test.t; +------+-------+---------------------+ | id | value | ts | +------+-------+---------------------+ | 1 | 10 | 2000-01-01 02:00:00 | +------+-------+---------------------+ mysql> SET time_zone = '+0:00'; set tidb_enable_chunk_rpc = 1; set session tidb_isolation_read_engines = 'tiflash'; select * from test.t; +------+-------+---------------------+ | id | value | ts | +------+-------+---------------------+ | 1 | 10 | 2000-01-01 02:00:00 | +------+-------+---------------------+ mysql> SET time_zone = 'Asia/Shanghai'; set tidb_enable_chunk_rpc = 0; set session tidb_isolation_read_engines = 'tiflash'; select * from test.t; +------+-------+---------------------+ | id | value | ts | +------+-------+---------------------+ | 1 | 10 | 2000-01-01 10:00:00 | +------+-------+---------------------+ mysql> SET time_zone = 'Asia/Shanghai'; set tidb_enable_chunk_rpc = 1; set session tidb_isolation_read_engines = 'tiflash'; select * from test.t; +------+-------+---------------------+ | id | value | ts | +------+-------+---------------------+ | 1 | 10 | 2000-01-01 10:00:00 | +------+-------+---------------------+ mysql> SET time_zone = 'UTC'; set tidb_enable_chunk_rpc = 0; set session tidb_isolation_read_engines = 'tiflash'; select * from test.t; +------+-------+---------------------+ | id | value | ts | +------+-------+---------------------+ | 1 | 10 | 2000-01-01 02:00:00 | +------+-------+---------------------+ mysql> SET time_zone = 'UTC'; set tidb_enable_chunk_rpc = 1; set session tidb_isolation_read_engines = 'tiflash'; select * from test.t; +------+-------+---------------------+ | id | value | ts | +------+-------+---------------------+ | 1 | 10 | 2000-01-01 02:00:00 | +------+-------+---------------------+ #Test duplicate column caused by join with other condition mysql> use test; set tidb_allow_mpp = 1; set session tidb_isolation_read_engines = 'tiflash'; select /*+ agg_to_cop() */ count(*), t1.value+1 from t join t1 on t.id = t1.id and t.value + t1.value + 1 > 10 group by t1.value + 1; +----------+------------+ | count(*) | t1.value+1 | +----------+------------+ | 1 | 16 | +----------+------------+ mysql> drop table if exists test.t; mysql> drop table if exists test.t1;