Simple utility that checks if if an AST entity refers to a entity
Remove aliases at the top level of the AST since they are not needed (quill uses select row indexes to figure out what data corresponds to what encodeable object) as well as entities whose aliases are the same as their selection e.g.
Filter out unused subquery properties.
Filter out unused subquery properties. This is safe to do after ExpandNestedQueries
now since all properties have been propagated from quats from parent to child
SQL select trees.
Remove aliases at the top level of the AST since they are not needed (quill uses select row indexes to figure out what data corresponds to what encodeable object) as well as entities whose aliases are the same as their selection e.g. "select x.foo as foo" since this just adds syntactic noise.