mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Bug#30573: Ordered range scan over partitioned tables returns some rows twice
and Bug#33555: Group By Query does not correctly aggregate partitions Backport of bug-33257 which is the same bug. read_range_*() calls was not passed to the partition handlers, but was translated to index_read/next family calls. Resulting in duplicates rows and wrong aggregations. mysql-test/r/partition_range.result: Bug#30573: Ordered range scan over partitioned tables returns some rows twice Updated result file mysql-test/t/partition_range.test: Bug#30573: Ordered range scan over partitioned tables returns some rows twice Re-enabled the test sql/ha_partition.cc: Bug#30573: Ordered range scan over partitioned tables returns some rows twice backport of bug-33257, correct handling of read_range_* calls, without converting them to index_read/next calls sql/ha_partition.h: Bug#30573: Ordered range scan over partitioned tables returns some rows twice backport of bug-33257, correct handling of read_range_* calls, without converting them to index_read/next calls
This commit is contained in:
@ -807,24 +807,24 @@ DROP TABLE t1;
|
||||
#
|
||||
# BUG#30573: get wrong result with "group by" on PARTITIONed table
|
||||
#
|
||||
#create table t1 (a int);
|
||||
#insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
|
||||
#CREATE TABLE t2 (
|
||||
# defid int(10) unsigned NOT NULL,
|
||||
# day int(10) unsigned NOT NULL,
|
||||
# count int(10) unsigned NOT NULL,
|
||||
# filler char(200),
|
||||
# KEY (defid,day)
|
||||
#)
|
||||
#PARTITION BY RANGE (day) (
|
||||
# PARTITION p7 VALUES LESS THAN (20070401) ,
|
||||
# PARTITION p8 VALUES LESS THAN (20070501));
|
||||
create table t1 (a int);
|
||||
insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
|
||||
CREATE TABLE t2 (
|
||||
defid int(10) unsigned NOT NULL,
|
||||
day int(10) unsigned NOT NULL,
|
||||
count int(10) unsigned NOT NULL,
|
||||
filler char(200),
|
||||
KEY (defid,day)
|
||||
)
|
||||
PARTITION BY RANGE (day) (
|
||||
PARTITION p7 VALUES LESS THAN (20070401) ,
|
||||
PARTITION p8 VALUES LESS THAN (20070501));
|
||||
|
||||
#insert into t2 select 20, 20070311, 1, 'filler' from t1 A, t1 B;
|
||||
#insert into t2 select 20, 20070411, 1, 'filler' from t1 A, t1 B;
|
||||
#insert into t2 values(52, 20070321, 123, 'filler') ;
|
||||
#insert into t2 values(52, 20070322, 456, 'filler') ;
|
||||
insert into t2 select 20, 20070311, 1, 'filler' from t1 A, t1 B;
|
||||
insert into t2 select 20, 20070411, 1, 'filler' from t1 A, t1 B;
|
||||
insert into t2 values(52, 20070321, 123, 'filler') ;
|
||||
insert into t2 values(52, 20070322, 456, 'filler') ;
|
||||
|
||||
#select sum(count) from t2 ch where ch.defid in (50,52) and ch.day between 20070320 and 20070401 group by defid;
|
||||
#drop table t1, t2;
|
||||
select sum(count) from t2 ch where ch.defid in (50,52) and ch.day between 20070320 and 20070401 group by defid;
|
||||
drop table t1, t2;
|
||||
|
||||
|
Reference in New Issue
Block a user