@@ -1199,16 +1199,6 @@ class Field: public Value_source
1199
1199
{ return binary () ? &my_charset_bin : charset (); }
1200
1200
virtual CHARSET_INFO *sort_charset (void ) const { return charset (); }
1201
1201
virtual bool has_charset (void ) const { return FALSE ; }
1202
- /*
1203
- match_collation_to_optimize_range() is to distinguish in
1204
- range optimizer (see opt_range.cc) between real string types:
1205
- CHAR, VARCHAR, TEXT
1206
- and the other string-alike types with result_type() == STRING_RESULT:
1207
- DATE, TIME, DATETIME, TIMESTAMP
1208
- We need it to decide whether to test if collation of the operation
1209
- matches collation of the field (needed only for real string types).
1210
- */
1211
- virtual bool match_collation_to_optimize_range () const { return false ; }
1212
1202
virtual void set_charset (CHARSET_INFO *charset_arg) { }
1213
1203
virtual enum Derivation derivation (void ) const
1214
1204
{ return DERIVATION_IMPLICIT; }
@@ -1359,6 +1349,15 @@ class Field: public Value_source
1359
1349
}
1360
1350
virtual bool can_optimize_group_min_max (const Item_bool_func *cond,
1361
1351
const Item *const_item) const ;
1352
+ /* *
1353
+ Test if Field can use range optimizer for a standard comparison operation:
1354
+ <=, <, =, <=>, >, >=
1355
+ Note, this method does not cover spatial operations.
1356
+ */
1357
+ virtual bool can_optimize_range (const Item_bool_func *cond,
1358
+ const Item *item,
1359
+ bool is_eq_func) const ;
1360
+
1362
1361
bool can_optimize_outer_join_table_elimination (const Item_bool_func *cond,
1363
1362
const Item *item) const
1364
1363
{
@@ -1583,13 +1582,15 @@ class Field_longstr :public Field_str
1583
1582
1584
1583
int store_decimal (const my_decimal *d);
1585
1584
uint32 max_data_length () const ;
1586
- bool match_collation_to_optimize_range () const { return true ; }
1587
1585
bool can_optimize_keypart_ref (const Item_bool_func *cond,
1588
1586
const Item *item) const ;
1589
1587
bool can_optimize_hash_join (const Item_bool_func *cond,
1590
1588
const Item *item) const ;
1591
1589
bool can_optimize_group_min_max (const Item_bool_func *cond,
1592
1590
const Item *const_item) const ;
1591
+ bool can_optimize_range (const Item_bool_func *cond,
1592
+ const Item *item,
1593
+ bool is_eq_func) const ;
1593
1594
};
1594
1595
1595
1596
/* base class for float and double and decimal (old one) */
@@ -2082,6 +2083,12 @@ class Field_temporal: public Field {
2082
2083
const Item *item) const ;
2083
2084
bool can_optimize_group_min_max (const Item_bool_func *cond,
2084
2085
const Item *const_item) const ;
2086
+ bool can_optimize_range (const Item_bool_func *cond,
2087
+ const Item *item,
2088
+ bool is_eq_func) const
2089
+ {
2090
+ return true ;
2091
+ }
2085
2092
};
2086
2093
2087
2094
@@ -3101,7 +3108,9 @@ class Field_geom :public Field_blob {
3101
3108
{ geom_type= geom_type_arg; srid= 0 ; }
3102
3109
enum ha_base_keytype key_type () const { return HA_KEYTYPE_VARBINARY2; }
3103
3110
enum_field_types type () const { return MYSQL_TYPE_GEOMETRY; }
3104
- bool match_collation_to_optimize_range () const { return false ; }
3111
+ bool can_optimize_range (const Item_bool_func *cond,
3112
+ const Item *item,
3113
+ bool is_eq_func) const ;
3105
3114
void sql_type (String &str) const ;
3106
3115
int store (const char *to, uint length, CHARSET_INFO *charset);
3107
3116
int store (double nr);
0 commit comments