title: How to order by ASC with NULLS LAST in HIVE
body: <p>NULLS LAST is not working - I get the following error on the subsequent query:
  FAILED: ParseException line 41:9 missing EOF at 'NULLS' near 'ASC'</p>
  
  <p>Not sure what the issue is, query otherwise runs and sorts fine without nulls last statement.</p>
  
  <pre><code>set hive.cli.print.header=true;
  
  SELECT 
      P3P.campaign_id, 
      P3P.campaign_name, 
      P3P.strategy_id, 
      P3P.strategy_name, 
      P3P.segment_id,
      P3P.full_path,
      COUNT(*) AS impressions,
      COUNT(DISTINCT P3P.mm_uuid) AS distinct_users,
      SUM(P3P.media_cost) AS media_cost, 
      SUM(P3P.total_ad_cost) AS total_ad_cost, 
      SUM(P3P.total_spend) AS total_spend,
      AVG(P3P.total_spend_cpm) AS cpm,
      SUM(CASE WHEN AE.event_type = 'click' THEN 1 ELSE NULL END) AS clicks,
      SUM(CASE WHEN AE.event_type = 'conversion' THEN 1 ELSE NULL END) AS conversions,
      (SUM(CASE WHEN AE.event_type = 'click' THEN 1 ELSE NULL END) / (COUNT(P3P.mm_uuid))) AS ctr,
      (SUM(CASE WHEN AE.event_type = 'click' THEN 1 ELSE NULL END) / (SUM(CASE WHEN AE.event_type = 'conversion' THEN 1 ELSE NULL END))) AS ctc,
      (SUM(P3P.total_spend)/(SUM(CASE WHEN AE.event_type = 'click' THEN 1 ELSE NULL END))) AS cost_per_click,
      (SUM(P3P.total_spend) /(SUM(CASE WHEN AE.event_type = 'conversion' THEN 1 ELSE NULL END))) AS cpa,
      ((SUM(CASE WHEN AE.event_type = 'conversion' THEN 1 ELSE NULL END))*1000)/COUNT(*) AS rr_per_1k_imps,
      AVG(P3P.segment_cpm) AS segment_cpm,
      (SUM(P3P.segment_spend)/(SUM(CASE WHEN AE.event_type = 'click' THEN 1 ELSE NULL END))) AS segment_cpc,
      (SUM(P3P.segment_spend)/(SUM(CASE WHEN AE.event_type = 'conversion' THEN 1 ELSE NULL END))) AS segment_cpc
  
  FROM tmp_perfon3p2 P3P
  
  LEFT JOIN mm_attributed_events AE ON AE.mm_uuid = P3P.mm_uuid 
      AND AE.event_date BETWEEN '2015-06-14' and '2015-06-21'
      AND  AE.organization_id = '100426'
      AND AE.agency_id = '101286'
      AND AE.advertiser_id = '108076'
  GROUP BY
      P3P.campaign_id, 
      P3P.campaign_name, 
      P3P.strategy_id, 
      P3P.strategy_name, 
      P3P.segment_id,
      P3P.full_path
  ORDER BY
      cpa ASC NULLS LAST
  LIMIT 100;
  </code></pre>