title: Hive," tablesample" 1 out of 2 fails, but 1 out of 4 is fine. why?
body: <p>step1, I have a created a bucketed table:</p>
  <pre><code>create table bucketed_users(id int, name string) 
  clustered by id into 4 buckets
  </code></pre>
  <p>step2, Load date and got 4 files in the folder /user/hive/warehouse/bucketed_users. Each file has valid data.</p>
  <p>step3, Got correct results:</p>
  <pre><code>select * from bucketed_users 
  tablesample(bucket 1 out of 4 on id)
  </code></pre>
  <p>step4, BUT FAILS ON:</p>
  <pre><code>select * from bucketed_users 
  tablesample(bucket 1 out of **2** on id)
  WITH ERROR NOTES: &quot;FAILED: ArrayIndexOutOfBoundsException 2&quot;
  </code></pre>
  <p>Please help to point the reason.</p>