Thank you Steven, this is useful info. I don't think we need now to cache the repeating execution results, but if it might quickly change when we will get to more complex queries.
About using nested tables to control the order of queries - I think the "WITH ..." statement makes a temp table, which teiid then uses internally to process subquery. I found that having continuous execution inside the WITH() statement and simply combining its output with a regular query makes strange results: DataNotAvailableException is not honored (setStrict is true). If I specifically join this two queries together - execution blocks. I do not have a good test code to illustrate this scenario, but I'll try spend some time later on research.
That is due to a processing change in the WITH clause logic in 8.1. The WITH clause is treated as declarative and each entry is created on demand rather than when processing initiates. So if no values from the WITH clause entry are used, we'll not process it. I'll add a note about that to the docs.