Type: New Feature
Affects Version/s: BIGDATA_RELEASE_1_1_0
Fix Version/s: None
Component/s: Query Plan Generator
As documented at , BSBM BI Q5 has two sub-selects which are identical. This case should be recognized by an AST optimizer and automatically lifted out into a named subquery.
The optimizer must look for the same set (without regard to order) of joins and filters with the same inputs and then lift those joins and filters into a named subquery. The example here is BSBM BI Q5.
This appear to be slightly different only because the first uses an alternative syntax for the triple pattern. However, they are precisely the same and should be lifted out entirely and replaced by a single named subquery. Again,  shows exactly what this should look like.
In this case, both sub-selects have precisely the same solution modifiers and the same projection. However, this optimization can in fact be done in cases where that is not true. We can simply run the result of the shared WHERE clause (or a common set of joins) into a named solution set and the INCLUDE the named solution set back into the query in order to pick up any additional joins or differences in the solution modifiers.