Github user Tagar commented on the issue:
https://github.com/apache/spark/pull/16228
@wzhfy, it's easier to check validity of these type of expressions when you
look at extreme cases.
Your formula for full outer join cardinality,
> cardinality = MAX(card(A) + card(B), innerCard(AB))
in one of extreme cases when set(A) and set(B) are the same sets, then
calculated cardinality would be 2 times more of the actual cardinality.
While
> full_outer_join_cardinality(table_A, table_B) = cardinality(A) +
cardinality(B) - inner_join_cardinality(table_A, table_B))
will produce correct result.
ps. I find this visualization
http://www.radacad.com/wp-content/uploads/2015/07/joins.jpg very helpful.
https://en.wikipedia.org/wiki/Inclusion%E2%80%93exclusion_principle A U B =
A + B - A \ B
Hope this helps. Thanks!
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]