MySQL 8.4.2
Source Code Documentation
anonymous_namespace{common_subexpression_elimination.cc} Namespace Reference

Functions

ItemOrGroupWithSomeRemoved (Item_cond_or *or_item, const List< Item > &items_to_remove)
 For an OR disjunction, return a new disjunction with elements from “items_to_remove” logically set to TRUE (ie., removed). More...
 
bool IsOr (const Item *item)
 
bool AlwaysPresent (Item *expr, const Item *item)
 Check if “item” is necessary to make the expression true. More...
 
bool MatchesAny (Item *item, const List< Item > &items)
 Check if “item” matches any item in “items”. More...
 
void ExtractItemsExceptSome (Item_cond_and *and_item, const List< Item > &items_to_remove, List< Item > *output)
 For all items in an AND conjunction, add those (possibly none) that are not in “items_to_remove”. More...
 

Function Documentation

◆ AlwaysPresent()

bool anonymous_namespace{common_subexpression_elimination.cc}::AlwaysPresent ( Item expr,
const Item item 
)

Check if “item” is necessary to make the expression true.

This is case if “expr” is either:

  • The same as “item”, or
  • (something necessary) OR (something necessary)
  • (something necessary) AND anything

A typical case would be of the latter would be

(item AND x) OR (item AND y) OR (z AND w AND item)

◆ ExtractItemsExceptSome()

void anonymous_namespace{common_subexpression_elimination.cc}::ExtractItemsExceptSome ( Item_cond_and and_item,
const List< Item > &  items_to_remove,
List< Item > *  output 
)

For all items in an AND conjunction, add those (possibly none) that are not in “items_to_remove”.

E.g., for a AND b AND c, and items_to_remove=(b), adds a and c to “output”.

◆ IsOr()

bool anonymous_namespace{common_subexpression_elimination.cc}::IsOr ( const Item item)

◆ MatchesAny()

bool anonymous_namespace{common_subexpression_elimination.cc}::MatchesAny ( Item item,
const List< Item > &  items 
)

Check if “item” matches any item in “items”.

◆ OrGroupWithSomeRemoved()

Item *anonymous_namespace common_subexpression_elimination anonymous_namespace{common_subexpression_elimination.cc}::cc::OrGroupWithSomeRemoved ( Item_cond_or or_item,
const List< Item > &  items_to_remove 
)

For an OR disjunction, return a new disjunction with elements from “items_to_remove” logically set to TRUE (ie., removed).

If any of the AND-within-OR groups become empty, the expression is always true and nullptr is returned. E.g.:

(a AND b) OR (c AND d), remove (b) => a OR (c AND d) (a AND b) OR (c AND d), remove (b,c) => a OR d (a AND b) OR (c AND d), remove (a,b) => nullptr