title: Parse error while using ROW_NUMBER OVER PARTITION BY
body: <p>I have used the below query on Hive and got the following parse error though the query does not seem to have any issues.</p>
  
  <pre><code>SELECT TO_DATE(o.order_date), profit, 
         ROW_NUMBER() OVER (PARTITION BY YEAR(o.order_date) ORDER BY profit desc) AS n 
  FROM (
      SELECT TO_DATE(o.order_date), SUM(price) AS revenue, 
             SUM(price-cost) as profit 
      FROM products p, order_details d, orders o 
      WHERE (d.prod_id=p.prod_id) AND (d.order_id=o.order_id) 
      GROUP BY o.order_date
  )
  </code></pre>
  
  <p>Error is:</p>
  
  <blockquote>
    <p>error while compiling statement: failed: parseexception line 6:22 cannot recognize input near '' '' '' in subquery source</p>
  </blockquote>