mirror of https://github.com/citusdata/citus.git
In this PR, we aim to deduce whether each of the RTE_RELATION is joined with at least on another RTE_RELATION on their partition keys. If each RTE_RELATION follows the above rule, we can conclude that all RTE_RELATIONs are joined on their partition keys. In order to do that, we invented a new equivalence class namely: AttributeEquivalenceClass. In very simple words, a AttributeEquivalenceClass is identified by an unique id and consists of a list of AttributeEquivalenceMembers. Each AttributeEquivalenceMember is designed to identify attributes uniquely within the whole query. The necessity of this arise since varno attributes are defined within a single level of a query. Instead, here we want to identify each RTE_RELATION uniquely and try to find equality among each RTE_RELATION's partition key. Whenever we find an equality clause A = B, where both A and B originates from relation attributes (i.e., not random expressions), we create an AttributeEquivalenceClass to record this knowledge. If we later find another equivalence B = C, we create another AttributeEquivalenceClass. Finally, we can apply transitity rules and generate a new AttributeEquivalenceClass which includes A, B and C. Note that equality among the members are identified by the varattno and rteIdentity. Each equality among RTE_RELATION is saved using an AttributeEquivalenceClass where each member attribute is identified by a AttributeEquivalenceMember. In the final step, we try generate a common attribute equivalence class that holds as much as AttributeEquivalenceMembers whose attributes are a partition keys. |
||
---|---|---|
.. | ||
agg.data | ||
agg_type.data | ||
customer-1-10.data | ||
customer-1-15.data | ||
customer-1-20.data | ||
customer-1-30.data | ||
customer-11-20.data | ||
customer-21-30.data | ||
customer.1.data | ||
customer.2.data | ||
customer.3.data | ||
events_table.data | ||
large_records.data | ||
lineitem.1.data | ||
lineitem.2.data | ||
nation.data | ||
orders.1.data | ||
orders.2.data | ||
part.data | ||
part.more.data | ||
supplier.data | ||
users_table.data |