List:Commits« Previous MessageNext Message »
From:eugene Date:July 29 2006 7:55pm
Subject:bk commit into 5.1 tree (evgen:1.2246)
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of evgen. When evgen does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet@stripped, 2006-07-29 23:54:55+04:00, evgen@stripped +4 -0
  Merge epotemkin@stripped:/home/bk/mysql-5.1
  into  sunlight.local:/local_work/tmp_merge-5.1-opt-mysql
  MERGE: 1.2181.163.1

  mysql-test/r/partition_pruning.result@stripped, 2006-07-29 23:54:51+04:00, evgen@stripped +0 -0
    Auto merged
    MERGE: 1.17.1.1

  mysql-test/t/partition_pruning.test@stripped, 2006-07-29 23:54:51+04:00, evgen@stripped +0 -0
    Auto merged
    MERGE: 1.14.1.1

  sql/sql_partition.cc@stripped, 2006-07-29 23:54:51+04:00, evgen@stripped +0 -0
    Auto merged
    MERGE: 1.80.1.1

  sql/sql_select.cc@stripped, 2006-07-29 23:54:51+04:00, evgen@stripped +0 -0
    Auto merged
    MERGE: 1.418.2.1

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	evgen
# Host:	sunlight.local
# Root:	/local_work/tmp_merge-5.1-opt-mysql/RESYNC

--- 1.423/sql/sql_select.cc	2006-07-29 23:55:00 +04:00
+++ 1.424/sql/sql_select.cc	2006-07-29 23:55:00 +04:00
@@ -14114,6 +14114,9 @@
       }
       item_list.push_back(new Item_string(table_name_buffer, len, cs));
     }
+    /* partitions */
+    if (join->thd->lex->describe & DESCRIBE_PARTITIONS)
+      item_list.push_back(item_null);
     /* type */
     item_list.push_back(new Item_string(join_type_str[JT_ALL],
 					  strlen(join_type_str[JT_ALL]),

--- 1.81/sql/sql_partition.cc	2006-07-29 23:55:00 +04:00
+++ 1.82/sql/sql_partition.cc	2006-07-29 23:55:00 +04:00
@@ -6577,10 +6577,19 @@
   
   store_key_image_to_rec(field, max_value, len);
   b= field->val_int();
+  
+  /* 
+    Handle a special case where the distance between interval bounds is 
+    exactly 4G-1. This interval is too big for range walking, and if it is an
+    (x,y]-type interval then the following "b +=..." code will convert it to 
+    an empty interval by "wrapping around" a + 4G-1 + 1 = a. 
+  */
+  if ((ulonglong)b - (ulonglong)a == ~0ULL)
+    return -1;
 
   a += test(flags & NEAR_MIN);
   b += test(!(flags & NEAR_MAX));
-  uint n_values= b - a;
+  ulonglong n_values= b - a;
   
   if (n_values > total_parts || n_values > MAX_RANGE_TO_WALK)
     return -1;
@@ -6684,7 +6693,8 @@
   while (part_iter->field_vals.cur != part_iter->field_vals.end)
   {
     longlong dummy;
-    field->store(part_iter->field_vals.cur++, FALSE);
+    field->store(part_iter->field_vals.cur++,
+                 ((Field_num*)field)->unsigned_flag);
     if (part_iter->part_info->is_sub_partitioned() &&
         !part_iter->part_info->get_part_partition_id(part_iter->part_info,
                                                      &part_id, &dummy) ||
@@ -6692,8 +6702,6 @@
                                                 &part_id, &dummy))
       return part_id;
   }
-  //psergey-todo: return partition(part_func(NULL)) here...
-  
   part_iter->field_vals.cur= part_iter->field_vals.start;
   return NOT_A_PARTITION_ID;
 }

--- 1.19/mysql-test/r/partition_pruning.result	2006-07-29 23:55:00 +04:00
+++ 1.20/mysql-test/r/partition_pruning.result	2006-07-29 23:55:00 +04:00
@@ -149,7 +149,85 @@
 explain partitions select * from t6 where a > 3 and a < 5;
 id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
 1	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	Impossible WHERE noticed after reading const tables
+drop table t6;
+create table t6 (a int unsigned not null) partition by LIST(a) (
+partition p1 values in (1),
+partition p3 values in (3),
+partition p5 values in (5),
+partition p7 values in (7),
+partition p9 values in (9)
+);
+insert into t6 values (1),(3),(5);
+explain partitions select * from t6 where a <  1;
+id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	Impossible WHERE noticed after reading const tables
+explain partitions select * from t6 where a <= 1;
+id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	t6	p1	system	NULL	NULL	NULL	NULL	1	
+explain partitions select * from t6 where a >  9;
+id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	Impossible WHERE noticed after reading const tables
+explain partitions select * from t6 where a >= 9;
+id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	Impossible WHERE noticed after reading const tables
+explain partitions select * from t6 where a > 0 and a < 5;
+id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	t6	p1,p3	ALL	NULL	NULL	NULL	NULL	2	Using where
+explain partitions select * from t6 where a > 5 and a < 12;
+id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	Impossible WHERE noticed after reading const tables
+explain partitions select * from t6 where a > 3 and a < 8 ;
+id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	t6	p5,p7	system	NULL	NULL	NULL	NULL	1	
+explain partitions select * from t6 where a >= 0 and a <= 5;
+id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	t6	p1,p3,p5	ALL	NULL	NULL	NULL	NULL	3	Using where
+explain partitions select * from t6 where a >= 5 and a <= 12;
+id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	t6	p5,p7,p9	system	NULL	NULL	NULL	NULL	1	
+explain partitions select * from t6 where a >= 3 and a <= 8;
+id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	t6	p3,p5,p7	ALL	NULL	NULL	NULL	NULL	2	Using where
+explain partitions select * from t6 where a > 3 and a < 5;
+id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	Impossible WHERE noticed after reading const tables
 create table t7 (a int not null) partition by RANGE(a) (
+partition p10 values less than (10),
+partition p30 values less than (30),
+partition p50 values less than (50),
+partition p70 values less than (70),
+partition p90 values less than (90)
+);
+insert into t7 values (10),(30),(50);
+explain partitions select * from t7 where a < 5;
+id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	Impossible WHERE noticed after reading const tables
+explain partitions select * from t7 where a < 10;
+id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	Impossible WHERE noticed after reading const tables
+explain partitions select * from t7 where a <= 10;
+id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	t7	p10,p30	system	NULL	NULL	NULL	NULL	1	
+explain partitions select * from t7 where a = 10;
+id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	t7	p30	system	NULL	NULL	NULL	NULL	1	
+explain partitions select * from t7 where a < 90;
+id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	t7	p10,p30,p50,p70,p90	ALL	NULL	NULL	NULL	NULL	3	Using where
+explain partitions select * from t7 where a = 90;
+id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	Impossible WHERE noticed after reading const tables
+explain partitions select * from t7 where a > 90;
+id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	Impossible WHERE noticed after reading const tables
+explain partitions select * from t7 where a >= 90;
+id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	Impossible WHERE noticed after reading const tables
+explain partitions select * from t7 where a > 11 and a < 29;
+id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	Impossible WHERE noticed after reading const tables
+drop table t7;
+create table t7 (a int unsigned not null) partition by RANGE(a) (
 partition p10 values less than (10),
 partition p30 values less than (30),
 partition p50 values less than (50),

--- 1.16/mysql-test/t/partition_pruning.test	2006-07-29 23:55:00 +04:00
+++ 1.17/mysql-test/t/partition_pruning.test	2006-07-29 23:55:00 +04:00
@@ -137,8 +137,60 @@
 
 explain partitions select * from t6 where a > 3 and a < 5;
 
+drop table t6;
+
+create table t6 (a int unsigned not null) partition by LIST(a) (
+  partition p1 values in (1),
+  partition p3 values in (3),
+  partition p5 values in (5),
+  partition p7 values in (7),
+  partition p9 values in (9)
+);
+insert into t6 values (1),(3),(5);
+
+explain partitions select * from t6 where a <  1;
+explain partitions select * from t6 where a <= 1;
+explain partitions select * from t6 where a >  9;
+explain partitions select * from t6 where a >= 9;
+
+explain partitions select * from t6 where a > 0 and a < 5;
+explain partitions select * from t6 where a > 5 and a < 12;
+explain partitions select * from t6 where a > 3 and a < 8 ;
+
+explain partitions select * from t6 where a >= 0 and a <= 5;
+explain partitions select * from t6 where a >= 5 and a <= 12;
+explain partitions select * from t6 where a >= 3 and a <= 8;
+
+explain partitions select * from t6 where a > 3 and a < 5;
+
 # RANGE(field) partitioning, interval analysis.
 create table t7 (a int not null) partition by RANGE(a) (
+  partition p10 values less than (10),
+  partition p30 values less than (30),
+  partition p50 values less than (50),
+  partition p70 values less than (70),
+  partition p90 values less than (90)
+);
+insert into t7 values (10),(30),(50);
+
+# leftmost intervals
+explain partitions select * from t7 where a < 5;
+explain partitions select * from t7 where a < 10;
+explain partitions select * from t7 where a <= 10;
+explain partitions select * from t7 where a = 10;
+
+#rightmost intervals
+explain partitions select * from t7 where a < 90;
+explain partitions select * from t7 where a = 90;
+explain partitions select * from t7 where a > 90;
+explain partitions select * from t7 where a >= 90;
+
+# misc intervals
+explain partitions select * from t7 where a > 11 and a < 29;
+
+drop table t7;
+
+create table t7 (a int unsigned not null) partition by RANGE(a) (
   partition p10 values less than (10),
   partition p30 values less than (30),
   partition p50 values less than (50),
Thread
bk commit into 5.1 tree (evgen:1.2246)eugene29 Jul