Start of refactoring QG to be external from logical plan