1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-07 00:04:31 +03:00

MDEV-19972 Move GIS code from Item_bool_func::get_full_func_mm_tree() to Item_func_spatial_rel::get_mm_leaf()

This commit is contained in:
Alexander Barkov
2019-07-05 20:52:59 +04:00
parent 2e57c8cc70
commit a6946c55d3
2 changed files with 10 additions and 19 deletions

View File

@@ -1062,9 +1062,17 @@ Item_func_spatial_rel::get_mm_leaf(RANGE_OPT_PARAM *param,
if (param->using_real_indexes && if (param->using_real_indexes &&
!field->optimize_range(param->real_keynr[key_part->key], !field->optimize_range(param->real_keynr[key_part->key],
key_part->part)) key_part->part))
DBUG_RETURN(0); DBUG_RETURN(0);
if (value->save_in_field_no_warnings(field, 1)) Field_geom *field_geom= dynamic_cast<Field_geom*>(field);
DBUG_ASSERT(field_geom);
const Type_handler_geometry *sav_geom_type= field_geom->type_handler_geom();
// We have to be able to store all sorts of spatial features here
field_geom->set_type_handler(&type_handler_geometry);
bool rc= value->save_in_field_no_warnings(field, 1);
field_geom->set_type_handler(sav_geom_type);
if (rc)
DBUG_RETURN(&sel_arg_impossible); // Bad GEOMETRY value DBUG_RETURN(&sel_arg_impossible); // Bad GEOMETRY value
DBUG_ASSERT(!field->real_maybe_null()); // SPATIAL keys do not support NULL DBUG_ASSERT(!field->real_maybe_null()); // SPATIAL keys do not support NULL

View File

@@ -8121,16 +8121,6 @@ SEL_TREE *Item_bool_func::get_full_func_mm_tree(RANGE_OPT_PARAM *param,
table_map ref_tables= 0; table_map ref_tables= 0;
table_map param_comp= ~(param->prev_tables | param->read_tables | table_map param_comp= ~(param->prev_tables | param->read_tables |
param->current_table); param->current_table);
#ifdef HAVE_SPATIAL
const Type_handler_geometry *sav_geom_type= NULL;
Field_geom *field_geom= dynamic_cast<Field_geom*>(field_item->field);
if (field_geom)
{
sav_geom_type= field_geom->type_handler_geom();
/* We have to be able to store all sorts of spatial features here */
field_geom->set_type_handler(&type_handler_geometry);
}
#endif /*HAVE_SPATIAL*/
for (uint i= 0; i < arg_count; i++) for (uint i= 0; i < arg_count; i++)
{ {
@@ -8158,13 +8148,6 @@ SEL_TREE *Item_bool_func::get_full_func_mm_tree(RANGE_OPT_PARAM *param,
} }
} }
#ifdef HAVE_SPATIAL
if (field_geom)
{
DBUG_ASSERT(sav_geom_type);
field_geom->set_type_handler(sav_geom_type);
}
#endif /*HAVE_SPATIAL*/
DBUG_RETURN(ftree); DBUG_RETURN(ftree);
} }