Below is the list of changes that have just been committed into a local
5.1 repository of timka. When timka 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
1.2281 06/04/04 14:15:01 timour@stripped +3 -0
Merge mysql.com:/home/timka/mysql/src/5.0-tmp-merge
into mysql.com:/home/timka/mysql/src/5.1-merge
sql/opt_range.cc
1.210 06/04/04 14:14:56 timour@stripped +0 -0
Auto merged
sql/item.h
1.195 06/04/04 14:14:56 timour@stripped +0 -0
Auto merged
sql/item.cc
1.179 06/04/04 14:14:56 timour@stripped +0 -0
Auto merged
# 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: timour
# Host: lamia.home
# Root: /home/timka/mysql/src/5.1-merge/RESYNC
--- 1.178/sql/item.cc 2006-04-01 10:38:28 +03:00
+++ 1.179/sql/item.cc 2006-04-04 14:14:56 +03:00
@@ -496,7 +496,7 @@
arguments in a condition the method must return false.
RETURN
- false to force the evaluation of collect_item_field_processor
+ FALSE to force the evaluation of collect_item_field_processor
for the subsequent items.
*/
@@ -514,6 +514,38 @@
}
item_list->push_back(this);
DBUG_RETURN(FALSE);
+}
+
+
+/*
+ Check if an Item_field references some field from a list of fields.
+
+ SYNOPSIS
+ Item_field::find_item_in_field_list_processor
+ arg Field being compared, arg must be of type Field
+
+ DESCRIPTION
+ Check whether the Item_field represented by 'this' references any
+ of the fields in the keyparts passed via 'arg'. Used with the
+ method Item::walk() to test whether any keypart in a sequence of
+ keyparts is referenced in an expression.
+
+ RETURN
+ TRUE if 'this' references the field 'arg'
+ FALE otherwise
+*/
+bool Item_field::find_item_in_field_list_processor(byte *arg)
+{
+ KEY_PART_INFO *first_non_group_part= *((KEY_PART_INFO **) arg);
+ KEY_PART_INFO *last_part= *(((KEY_PART_INFO **) arg) + 1);
+ KEY_PART_INFO *cur_part;
+
+ for (cur_part= first_non_group_part; cur_part != last_part; cur_part++)
+ {
+ if (field->eq(cur_part->field))
+ return TRUE;
+ }
+ return FALSE;
}
--- 1.194/sql/item.h 2006-03-03 12:48:52 +02:00
+++ 1.195/sql/item.h 2006-04-04 14:14:56 +03:00
@@ -741,6 +741,7 @@
virtual bool remove_fixed(byte * arg) { fixed= 0; return 0; }
virtual bool cleanup_processor(byte *arg);
virtual bool collect_item_field_processor(byte * arg) { return 0; }
+ virtual bool find_item_in_field_list_processor(byte *arg) { return 0; }
virtual bool change_context_processor(byte *context) { return 0; }
virtual bool reset_query_id_processor(byte *query_id) { return 0; }
@@ -1193,6 +1194,7 @@
bool is_null() { return field->is_null(); }
Item *get_tmp_table_item(THD *thd);
bool collect_item_field_processor(byte * arg);
+ bool find_item_in_field_list_processor(byte *arg);
bool reset_query_id_processor(byte *arg)
{
field->query_id= *((query_id_t *) arg);
--- 1.209/sql/opt_range.cc 2006-03-31 14:19:57 +03:00
+++ 1.210/sql/opt_range.cc 2006-04-04 14:14:56 +03:00
@@ -8189,6 +8189,7 @@
bool have_min, bool have_max,
double *read_cost, ha_rows *records);
+
/*
Test if this access method is applicable to a GROUP query with MIN/MAX
functions, and if so, construct a new TRP object.
@@ -8595,11 +8596,36 @@
}
else if (min_max_arg_part &&
(min_max_arg_part - first_non_group_part > 0))
+ {
/*
There is a gap but no range tree, thus no predicates at all for the
non-group keyparts.
*/
goto next_index;
+ }
+ else if (first_non_group_part && join->conds)
+ {
+ /*
+ If there is no MIN/MAX function in the query, but some index
+ key part is referenced in the WHERE clause, then this index
+ cannot be used because the WHERE condition over the keypart's
+ field cannot be 'pushed' to the index (because there is no
+ range 'tree'), and the WHERE clause must be evaluated before
+ GROUP BY/DISTINCT.
+ */
+ /*
+ Store the first and last keyparts that need to be analyzed
+ into one array that can be passed as parameter.
+ */
+ KEY_PART_INFO *key_part_range[2];
+ key_part_range[0]= first_non_group_part;
+ key_part_range[1]= last_part;
+
+ /* Check if cur_part is referenced in the WHERE clause. */
+ if (join->conds->walk(&Item::find_item_in_field_list_processor,
+ (byte*) key_part_range))
+ goto next_index;
+ }
}
/*
| Thread |
|---|
| • bk commit into 5.1 tree (timour:1.2281) | timour | 4 Apr |