summaryrefslogtreecommitdiff
path: root/sql/sql_type.h
diff options
context:
space:
mode:
Diffstat (limited to 'sql/sql_type.h')
-rw-r--r--sql/sql_type.h45
1 files changed, 33 insertions, 12 deletions
diff --git a/sql/sql_type.h b/sql/sql_type.h
index db4f67e343f..271e74a9762 100644
--- a/sql/sql_type.h
+++ b/sql/sql_type.h
@@ -4049,9 +4049,21 @@ public:
Item *target_expr, Item *target_value,
Item_bool_func2 *source,
Item *source_expr, Item *source_const) const= 0;
+
+ /*
+ @brief
+ Check if an IN subquery allows materialization or not
+ @param
+ inner expression on the inner side of the IN subquery
+ outer expression on the outer side of the IN subquery
+ is_in_predicate SET to true if IN subquery was converted from an
+ IN predicate or we are checking if materialization
+ strategy can be used for an IN predicate
+ */
virtual bool
subquery_type_allows_materialization(const Item *inner,
- const Item *outer) const= 0;
+ const Item *outer,
+ bool is_in_predicate) const= 0;
/**
Make a simple constant replacement item for a constant "src",
so the new item can futher be used for comparison with "cmp", e.g.:
@@ -4311,8 +4323,8 @@ public:
DBUG_ASSERT(0);
return 0;
}
- bool subquery_type_allows_materialization(const Item *inner,
- const Item *outer) const override
+ bool subquery_type_allows_materialization(const Item *, const Item *,
+ bool) const override
{
DBUG_ASSERT(0);
return false;
@@ -4714,7 +4726,8 @@ public:
int stored_field_cmp_to_item(THD *thd, Field *field, Item *item)
const override;
bool subquery_type_allows_materialization(const Item *inner,
- const Item *outer)
+ const Item *outer,
+ bool is_in_predicate)
const override;
void make_sort_key_part(uchar *to, Item *item,
const SORT_FIELD_ATTR *sort_field,
@@ -4819,7 +4832,9 @@ public:
return item_val.is_null() ? 0 : my_decimal(field).cmp(item_val.ptr());
}
bool subquery_type_allows_materialization(const Item *inner,
- const Item *outer) const override;
+ const Item *outer,
+ bool is_in_predicate)
+ const override;
Field *make_schema_field(MEM_ROOT *root,
TABLE *table,
const Record_addr &addr,
@@ -5073,7 +5088,9 @@ public:
const Type_handler *type_handler_for_comparison() const override;
int stored_field_cmp_to_item(THD *thd, Field *field, Item *item) const override;
bool subquery_type_allows_materialization(const Item *inner,
- const Item *outer) const override;
+ const Item *outer,
+ bool is_in_predicate)
+ const override;
Field *make_num_distinct_aggregator_field(MEM_ROOT *, const Item *) const override;
Field *make_table_field(MEM_ROOT *root,
const LEX_CSTRING *name,
@@ -5214,7 +5231,9 @@ public:
Item *source_expr, Item *source_const)
const override;
bool subquery_type_allows_materialization(const Item *inner,
- const Item *outer) const override;
+ const Item *outer,
+ bool is_in_predicate)
+ const override;
bool Item_func_min_max_fix_attributes(THD *thd, Item_func_min_max *func,
Item **items, uint nitems)
const override;
@@ -5352,7 +5371,9 @@ public:
Item *source_expr, Item *source_const) const
override;
bool subquery_type_allows_materialization(const Item *inner,
- const Item *outer) const override;
+ const Item *outer,
+ bool is_in_predicate)
+ const override;
Item *make_const_item_for_comparison(THD *, Item *src, const Item *cmp) const
override;
Item_cache *Item_get_cache(THD *thd, const Item *item) const override;
@@ -6983,8 +7004,8 @@ public:
{
return blob_type_handler(item);
}
- bool subquery_type_allows_materialization(const Item *inner,
- const Item *outer) const override
+ bool subquery_type_allows_materialization(const Item *, const Item *, bool)
+ const override
{
return false; // Materialization does not work with BLOB columns
}
@@ -7114,7 +7135,7 @@ public:
{
return MYSQL_TYPE_BLOB_COMPRESSED;
}
- ulong KEY_pack_flags(uint column_nr) const override
+ ulong KEY_pack_flags(uint) const override
{
DBUG_ASSERT(0);
return 0;
@@ -7125,7 +7146,7 @@ public:
Field *make_conversion_table_field(MEM_ROOT *root,
TABLE *table, uint metadata,
const Field *target) const override;
- enum_dynamic_column_type dyncol_type(const Type_all_attributes *attr)
+ enum_dynamic_column_type dyncol_type(const Type_all_attributes *)
const override
{
DBUG_ASSERT(0);