Refactor: separating input from context in planning

o using an unique context when planning
o sub query lookup table is not in the context anymore
Merge pull request #2560 from davidegrohmann/2.1-pattern-expressions

 Refactor: separating input from context in planning