mirror of
https://github.com/MariaDB/server.git
synced 2025-12-24 11:21:21 +03:00
Merge
BitKeeper/etc/logging_ok: auto-union Makefile.am: Auto merged mysql-test/mysql-test-run.sh: Auto merged mysql-test/r/information_schema_db.result: Auto merged sql/field.cc: Auto merged sql/field.h: Auto merged sql/ha_federated.cc: Auto merged sql/ha_innodb.cc: Auto merged sql/ha_myisam.cc: Auto merged sql/ha_myisammrg.cc: Auto merged sql/ha_ndbcluster.cc: Auto merged sql/handler.cc: Auto merged sql/item.cc: Auto merged sql/log.cc: Auto merged sql/log_event.cc: Auto merged sql/mysql_priv.h: Auto merged sql/mysqld.cc: Auto merged sql/opt_range.cc: Auto merged sql/sql_base.cc: Auto merged sql/sql_class.h: Auto merged sql/sql_insert.cc: Auto merged sql/sql_lex.cc: Auto merged sql/sql_lex.h: Auto merged sql/sql_load.cc: Auto merged sql/sql_parse.cc: Auto merged sql/sql_repl.cc: Auto merged sql/sql_select.cc: Auto merged sql/sql_table.cc: Auto merged sql/sql_udf.cc: Auto merged sql/sql_yacc.yy: Auto merged sql/unireg.cc: Auto merged storage/innobase/row/row0mysql.c: Auto merged storage/innobase/srv/srv0start.c: Auto merged storage/innobase/trx/trx0trx.c: Auto merged storage/myisam/rt_split.c: Auto merged storage/myisammrg/myrg_open.c: Auto merged storage/ndb/src/common/debugger/SignalLoggerManager.cpp: Auto merged storage/ndb/src/common/util/File.cpp: Auto merged storage/ndb/src/cw/cpcd/Process.cpp: Auto merged storage/ndb/src/kernel/blocks/dbtux/Dbtux.hpp: Auto merged storage/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp: Auto merged storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp: Auto merged sql/sql_delete.cc: merge sql/sql_update.cc: merge sql/table.cc: SCCS merged support-files/mysql.spec.sh: merge
This commit is contained in:
@@ -36,7 +36,7 @@
|
||||
QUICK_RANGEs are also created in this step.
|
||||
*/
|
||||
|
||||
#ifdef __GNUC__
|
||||
#ifdef USE_PRAGMA_IMPLEMENTATION
|
||||
#pragma implementation // gcc: Class implementation
|
||||
#endif
|
||||
|
||||
@@ -3313,32 +3313,35 @@ QUICK_SELECT_I *TRP_ROR_UNION::make_quick(PARAM *param,
|
||||
|
||||
|
||||
/*
|
||||
Build a SEL_TREE for <> predicate
|
||||
Build a SEL_TREE for <> or NOT BETWEEN predicate
|
||||
|
||||
SYNOPSIS
|
||||
get_ne_mm_tree()
|
||||
param PARAM from SQL_SELECT::test_quick_select
|
||||
cond_func item for the predicate
|
||||
field field in the predicate
|
||||
value constant in the predicate
|
||||
lt_value constant that field should be smaller
|
||||
gt_value constant that field should be greaterr
|
||||
cmp_type compare type for the field
|
||||
|
||||
RETURN
|
||||
Pointer to tree built tree
|
||||
# Pointer to tree built tree
|
||||
0 on error
|
||||
*/
|
||||
|
||||
static SEL_TREE *get_ne_mm_tree(PARAM *param, Item_func *cond_func,
|
||||
Field *field, Item *value,
|
||||
Field *field,
|
||||
Item *lt_value, Item *gt_value,
|
||||
Item_result cmp_type)
|
||||
{
|
||||
SEL_TREE *tree= 0;
|
||||
SEL_TREE *tree;
|
||||
tree= get_mm_parts(param, cond_func, field, Item_func::LT_FUNC,
|
||||
value, cmp_type);
|
||||
lt_value, cmp_type);
|
||||
if (tree)
|
||||
{
|
||||
tree= tree_or(param, tree, get_mm_parts(param, cond_func, field,
|
||||
Item_func::GT_FUNC,
|
||||
value, cmp_type));
|
||||
gt_value, cmp_type));
|
||||
}
|
||||
return tree;
|
||||
}
|
||||
@@ -3371,21 +3374,14 @@ static SEL_TREE *get_func_mm_tree(PARAM *param, Item_func *cond_func,
|
||||
switch (cond_func->functype()) {
|
||||
|
||||
case Item_func::NE_FUNC:
|
||||
tree= get_ne_mm_tree(param, cond_func, field, value, cmp_type);
|
||||
tree= get_ne_mm_tree(param, cond_func, field, value, value, cmp_type);
|
||||
break;
|
||||
|
||||
case Item_func::BETWEEN:
|
||||
if (inv)
|
||||
{
|
||||
tree= get_mm_parts(param, cond_func, field, Item_func::LT_FUNC,
|
||||
cond_func->arguments()[1],cmp_type);
|
||||
if (tree)
|
||||
{
|
||||
tree= tree_or(param, tree, get_mm_parts(param, cond_func, field,
|
||||
Item_func::GT_FUNC,
|
||||
cond_func->arguments()[2],
|
||||
cmp_type));
|
||||
}
|
||||
tree= get_ne_mm_tree(param, cond_func, field, cond_func->arguments()[1],
|
||||
cond_func->arguments()[2], cmp_type);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -3408,7 +3404,8 @@ static SEL_TREE *get_func_mm_tree(PARAM *param, Item_func *cond_func,
|
||||
if (inv)
|
||||
{
|
||||
tree= get_ne_mm_tree(param, cond_func, field,
|
||||
func->arguments()[1], cmp_type);
|
||||
func->arguments()[1], func->arguments()[1],
|
||||
cmp_type);
|
||||
if (tree)
|
||||
{
|
||||
Item **arg, **end;
|
||||
@@ -3416,7 +3413,7 @@ static SEL_TREE *get_func_mm_tree(PARAM *param, Item_func *cond_func,
|
||||
arg < end ; arg++)
|
||||
{
|
||||
tree= tree_and(param, tree, get_ne_mm_tree(param, cond_func, field,
|
||||
*arg, cmp_type));
|
||||
*arg, *arg, cmp_type));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3529,17 +3526,18 @@ static SEL_TREE *get_mm_tree(PARAM *param,COND *cond)
|
||||
Item_func *cond_func= (Item_func*) cond;
|
||||
if (cond_func->functype() == Item_func::NOT_FUNC)
|
||||
{
|
||||
/* Optimize NOT BETWEEN and NOT IN */
|
||||
Item *arg= cond_func->arguments()[0];
|
||||
if (arg->type() == Item::FUNC_ITEM)
|
||||
{
|
||||
cond_func= (Item_func*) arg;
|
||||
if (cond_func->select_optimize() == Item_func::OPTIMIZE_NONE)
|
||||
DBUG_RETURN(0);
|
||||
inv= TRUE;
|
||||
inv= TRUE;
|
||||
}
|
||||
else
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
}
|
||||
else if (cond_func->select_optimize() == Item_func::OPTIMIZE_NONE)
|
||||
DBUG_RETURN(0);
|
||||
|
||||
@@ -7988,8 +7986,17 @@ void QUICK_GROUP_MIN_MAX_SELECT::update_key_stat()
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (have_min && min_max_arg_part && min_max_arg_part->field->is_null())
|
||||
else if (have_min && min_max_arg_part &&
|
||||
min_max_arg_part->field->real_maybe_null())
|
||||
{
|
||||
/*
|
||||
If a MIN/MAX argument value is NULL, we can quickly determine
|
||||
that we're in the beginning of the next group, because NULLs
|
||||
are always < any other value. This allows us to quickly
|
||||
determine the end of the current group and jump to the next
|
||||
group (see next_min()) and thus effectively increases the
|
||||
usable key length.
|
||||
*/
|
||||
max_used_key_length+= min_max_arg_len;
|
||||
++used_key_parts;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user