[Commits] 0a86a91: MDEV-10765: Wrong result - query does not retrieve values from default partition on a table partitioned by list columns

Sergey Petrunia sergey at mariadb.com
Fri Sep 9 01:21:19 EEST 2016


Hi Sanja,

> revision-id: 0a86a915842d268477c5febd8481263f00d6c792 (mariadb-10.1.8-242-g0a86a91)
> parent(s): effb65bc863da0f1115e16ef5f11d11a13cdc7a0
> committer: Oleksandr Byelkin
> timestamp: 2016-09-08 19:43:09 +0200
> message:
> 
> MDEV-10765: Wrong result - query does not retrieve values from default partition on a table partitioned by list columns
> 
> Partial matches should be treat as not exact one.
> 

So I'm running this example:

create table t14n
( 
  a int not null,
  b int not null,
  c int
)
partition by list columns(a,b) 
(
  partition p1 values in ((10,10)), 
  partition p2 values in ((10,20)), 
  partition p3 values in ((10,30)),
  partition p4 values in ((10,40)), 
  partition p5 values in ((10,50)) 
);

insert into t14n values 
  (10,10,1234), 
  (10,20,1234), 
  (10,30,1234),
  (10,40,1234), 
  (10,50,1234);


explain partitions 
select * from t14n 
where a>=10  and (a <=10 and b <=30);

and then I get:

#1  0x0000555555eb88ef in get_part_iter_for_interval_cols_via_map (part_info=0x7fff90046208, is_subpart=false, store_length_array=0x7ffff436a0a0, min_value=0x7fff90069518 "\n", max_value=0x7fff90069528 "\n", min_len=8, max_len=4, flags=0, part_iter=0x7ffff436a858) at /home/psergey/dev-git/10.2/sql/sql_partition.cc:7751

This means I get all the way to the

  memcmp(min_value, max_value, min_len)

call, where min_len=8, max_len=4, which means we're comparing garbage.
Please add a check that min_len==max_len.

Ok to push after this is addressed.

On Thu, Sep 08, 2016 at 07:43:10PM +0200, Oleksandr Byelkin wrote:
> diff --git a/sql/sql_partition.cc b/sql/sql_partition.cc
> index 54396b9..24dff23 100644
> --- a/sql/sql_partition.cc
> +++ b/sql/sql_partition.cc
> @@ -7723,6 +7723,7 @@ int get_part_iter_for_interval_cols_via_map(partition_info *part_info,
>    bool can_match_multiple_values;
>    uint32 nparts;
>    get_col_endpoint_func  UNINIT_VAR(get_col_endpoint);
> +  uint full_length= 0;
>    DBUG_ENTER("get_part_iter_for_interval_cols_via_map");
>  
>    if (part_info->part_type == RANGE_PARTITION)
> @@ -7740,9 +7741,13 @@ int get_part_iter_for_interval_cols_via_map(partition_info *part_info,
>    else
>      assert(0);
>  
> +  for (uint32 i= 0; i < part_info->num_columns; i++)
> +    full_length+= store_length_array[i];
> +
>    can_match_multiple_values= ((flags &
>                                 (NO_MIN_RANGE | NO_MAX_RANGE | NEAR_MIN |
>                                  NEAR_MAX)) ||
> +                              (min_len != full_length) ||
>                                memcmp(min_value, max_value, min_len));
>    DBUG_ASSERT(can_match_multiple_values || (flags & EQ_RANGE) || flags == 0);
>    if (can_match_multiple_values && part_info->has_default_partititon())
> _______________________________________________
> commits mailing list
> commits at mariadb.org
> https://lists.askmonty.org/cgi-bin/mailman/listinfo/commits

-- 
BR
 Sergei
-- 
Sergei Petrunia, Software Developer
MariaDB Corporation | Skype: sergefp | Blog: http://s.petrunia.net/blog




More information about the commits mailing list