List:Commits« Previous MessageNext Message »
From:Mikael Ronstrom Date:July 31 2009 1:01pm
Subject:bzr commit into mysql-5.4 branch (mikael:2748)
View as plain text  
#At file:///home/mikael/mysql_clones/mysql-azalea-wl3352/

 2748 Mikael Ronstrom	2009-07-31
      Missed check for column list partitioning in get_next_partition_id_list and also missed to initialise part_iter->part_info in get_part_iter_for_cols_interval_via_map
      modified:
        mysql-test/t/partition_column.test
        sql/partition_info.cc
        sql/sql_partition.cc

=== modified file 'mysql-test/t/partition_column.test'
--- a/mysql-test/t/partition_column.test	2009-07-31 09:17:16 +0000
+++ b/mysql-test/t/partition_column.test	2009-07-31 13:01:56 +0000
@@ -8,6 +8,13 @@
 drop table if exists t1;
 --enable_warnings
 
+create table t1 (a char, b char, c char)
+partition by list column_list(a)
+( partition p0 values in (column_list('a')));
+insert into t1 (a) values ('a');
+select * from t1 where a = 'a';
+drop table t1;
+
 --error ER_WRONG_TYPE_COLUMN_VALUE_ERROR
 create table t1 (d timestamp)
 partition by range column_list(d)

=== modified file 'sql/partition_info.cc'
--- a/sql/partition_info.cc	2009-07-30 15:20:56 +0000
+++ b/sql/partition_info.cc	2009-07-31 13:01:56 +0000
@@ -956,7 +956,8 @@ bool partition_info::check_list_constant
   if (column_list)
   {
     part_column_list_val *loc_list_col_array;
-    loc_list_col_array= list_col_array= (part_column_list_val*)ptr;
+    loc_list_col_array= (part_column_list_val*)ptr;
+    list_col_array= (part_column_list_val*)ptr;
     compare_func= compare_column_values;
     i= 0;
     /*
@@ -1007,6 +1008,10 @@ bool partition_info::check_list_constant
   if (fixed && no_list_values)
   {
     bool first= TRUE;
+    /*
+      list_array and list_col_array are unions, so this works for both
+      variants of LIST partitioning.
+    */
     my_qsort((void*)list_array, no_list_values, size_entries, 
              compare_func);
 

=== modified file 'sql/sql_partition.cc'
--- a/sql/sql_partition.cc	2009-07-30 15:20:56 +0000
+++ b/sql/sql_partition.cc	2009-07-31 13:01:56 +0000
@@ -6651,16 +6651,19 @@ void make_used_partitions_str(partition_
   IMPLEMENTATION
     There are two available interval analyzer functions:
     (1) get_part_iter_for_interval_via_mapping 
-    (2) get_part_iter_for_interval_via_walking
+    (2) get_part_iter_for_cols_interval_via_map
+    (3) get_part_iter_for_interval_via_walking
 
     They both have limited applicability:
     (1) is applicable for "PARTITION BY <RANGE|LIST>(func(t.field))", where
     func is a monotonic function.
-    
-    (2) is applicable for 
+
+    (2) is applicable for "PARTITION BY <RANGE|LIST> COLUMN_LIST (field_list)
+
+    (3) is applicable for 
       "[SUB]PARTITION BY <any-partitioning-type>(any_func(t.integer_field))"
       
-    If both are applicable, (1) is preferred over (2).
+    If both (1) and (2) are applicable, (1) is preferred over (2).
     
     This function sets part_info::get_part_iter_for_interval according to
     this criteria, and also sets some auxilary fields that the function
@@ -6693,7 +6696,7 @@ static void set_up_range_analysis_info(p
     {
       part_info->get_part_iter_for_interval= 
         get_part_iter_for_cols_interval_via_map;
-      return;
+      goto setup_subparts;
     }
   default:
     ;
@@ -6940,6 +6943,7 @@ int get_part_iter_for_cols_interval_via_
   {
     get_col_endpoint= get_partition_id_cols_list_for_endpoint;
     part_iter->get_next= get_next_partition_id_list;
+    part_iter->part_info= part_info;
   }
   if (flags & NO_MIN_RANGE)
     part_iter->part_nums.start= part_iter->part_nums.cur= 0;
@@ -7276,7 +7280,8 @@ uint32 get_next_partition_id_range(PARTI
   DESCRIPTION
     This implementation of PARTITION_ITERATOR::get_next() is special for 
     LIST partitioning: it enumerates partition ids in 
-    part_info->list_array[i] where i runs over [min_idx, max_idx] interval.
+    part_info->list_array[i] (list_col_array[i] for COLUMN_LIST LIST
+    partitioning) where i runs over [min_idx, max_idx] interval.
     The function conforms to partition_iter_func type.
 
   RETURN 
@@ -7298,8 +7303,13 @@ uint32 get_next_partition_id_list(PARTIT
     return NOT_A_PARTITION_ID;
   }
   else
-    return part_iter->part_info->list_array[part_iter->
-                                            part_nums.cur++].partition_id;
+  {
+    partition_info *part_info= part_iter->part_info;
+    uint32 num_part= part_iter->part_nums.cur++;
+    return part_info->column_list ?
+           part_info->list_col_array[num_part].partition_id :
+           part_info->list_array[num_part].partition_id;
+  }
 }
 
 

Thread
bzr commit into mysql-5.4 branch (mikael:2748) Mikael Ronstrom31 Jul