title: AWS Athena ALIAS in Group By does not get resolved
body: <p>I have a very basic group by query in Athena where I would like to use an alias. One can make the example work by putting the same reference in the group by, but that's not really handy when there's complex column modifications going on and logic needs to be copied in two places. Also I did that in the past and now I have a statement that doesn't work by copying over.</p>
  
  <p>Problem:</p>
  
  <pre class="lang-sql prettyprint-override"><code>SELECT 
      substr(accountDescriptor, 5) as account, 
      sum(revenue) as grossRevenue 
  FROM sales 
  GROUP BY account
  </code></pre>
  
  <p>This will throw an error:</p>
  
  <blockquote>
    <p>alias Column 'account' cannot be resolved</p>
  </blockquote>
  
  <p>The following works, so it's about the alias handling.</p>
  
  <pre class="lang-sql prettyprint-override"><code>SELECT 
      substr(accountDescriptor, 5) as account, 
      sum(revenue) as grossRevenue 
  FROM sales 
  GROUP BY substr(accountDescriptor, 5)
  </code></pre>