We've recently been improving our query lifecycle by adding explicit state transitions so it's easier to reason about what should happen at a given stage in the lifetime of a query or a fragment instance.
On the coordinator side. The coordinator's view of the query: https://github.com/apache/impala/commit/6ca87e46736a1e591ed7d7d5fee05b4b4d2fbb50
On the fragment instance state side. A FIS's view of its own execution:
We don't have something like this for the QueryState class which maintains query wide state per executor. Adding it should make the lifecycle of a query from an executors point of view much easier to reason about.