hpcc-systems/HPCC-Platform — pull request #2710 by ghalliday (2012-06-28 11:35:51+00:00)
Title: Reimplement the way child queries are commoned up.

This is a reasonably substantial change. It is partially complete, but
sufficiently good to be released and used as a building block for
further work.

The main change is in the code that spots multiple dataset operations
that will require a child query to be generated to execute them, and
combine them into a single child query so that any shared code is
only evalauted once.

The new transformer has the following stages
a) track which expressions are conditional/unconditional
b) work out which expressions are candidates for commoning up
c) calculate where those commoned up expressions should be evaluated
d) what if() conditions are needed to protect the canidate expressions
if they are executed all together?
e) What are the final conclusions on which candidates to combine.

One difference is that the transformer now creates a graph node to
represent the child query (no_childquery) instead of directly building
the child query.
This helps prepares the way for a long term goal of performing all tree
transformations up front before we start to generate any code. There
are still other things that prevent that, but this was a key issue.

Associated changes include refactoring of the transformer that
works out whether something is conditional. Disassociating the unique
id that represents a graph from the activity id of the graph,
supporting no_compound in more places (although not actually needed for
these changes).

In future I would hope to also combine some conditional child graphs
but that will require problems in other areas to be fixed first.