Skip to content

Commit

Permalink
MDEV-19972 Move GIS code from Item_bool_func::get_full_func_mm_tree()…
Browse files Browse the repository at this point in the history
… to Item_func_spatial_rel::get_mm_leaf()
  • Loading branch information
abarkov committed Jul 5, 2019
1 parent 2e57c8c commit a6946c5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 19 deletions.
12 changes: 10 additions & 2 deletions sql/item_geofunc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1062,9 +1062,17 @@ Item_func_spatial_rel::get_mm_leaf(RANGE_OPT_PARAM *param,
if (param->using_real_indexes &&
!field->optimize_range(param->real_keynr[key_part->key],
key_part->part))
DBUG_RETURN(0);
DBUG_RETURN(0);

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 (value->save_in_field_no_warnings(field, 1))
if (rc)
DBUG_RETURN(&sel_arg_impossible); // Bad GEOMETRY value

DBUG_ASSERT(!field->real_maybe_null()); // SPATIAL keys do not support NULL
Expand Down
17 changes: 0 additions & 17 deletions sql/opt_range.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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 param_comp= ~(param->prev_tables | param->read_tables |
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++)
{
Expand Down Expand Up @@ -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);
}

Expand Down

0 comments on commit a6946c5

Please sign in to comment.