Follow-up of the work in
HIVE-16602. HIVE-16602 introduced an optimization that identifies scans on input tables that can be merged so the data is read only once.
This extension to that rule allows to reuse the computation that is done in the work containing those scans. In particular, we traverse both parts of the plan upstream and reuse the operators if possible.
Currently, the optimizer will not go beyond the output edge(s) of that work. Follow-up extensions might remove this limitation.