LowerTableIR and nested CDAs

This doesn’t work right now – How do I embed this in a TableFilter, for instance, without writing the entire table query in a single Python expression?

You could build it modularly but you’d have to pass the aggregated value in. Without subqueries, that’s what you need to do.

Python would also need to have different binding/scope rules.
A normal Let won’t put “foo” into the environment where it’s needed, which is inside a relational IR within the body.

I see. I’ve never really understood relational lets.

I’d argue relational lets should go away and let bindings should be visible in relational nodes. I see why this was hard to implement in the Table.execute world, but this is easy to do in lowering.

StreamMap …

What is that StreamMap inside?

Proposal #1 has the nice property …

I’m saying the output of Proposal #1 and #2 should be the same. We need to understand what IR we want to produce, and implement that. There is no reason to pull something out in #1 and not pull it out in #2. Whether the code is a separate pass or done inside of lowering seems incidental to me.