title: NTILE function performance in hive
body: <p>Is there any way we can optimize the NTILE function run time. Currently, we have around 51M records with 17 variables. 
  We are performing below query to divide the datasets in to 100 buckets.</p>
  
  <pre><code>create table secondary_table  
  stored as orc 
  as
  select a.*,NTILE(100) OVER(ORDER BY score) AS score_rank
  from main_table a;
  </code></pre>
  
  <p>Here score variable represents 12 digit decimal values.</p>
  
  <p>As of now all the load is getting dumped to one reducer which is taking a lot of time after completing 99%. Is there any approach we can optimize it as the current query is taking around 35 min. to execute.</p>
  
  <p>Appreciate any response.</p>
  
  <p>Thanks In advance.</p>