private void setBucketProperty(Configuration hiveConf, Object row, int bucketId) {
    int encodedBucketValue = BucketCodec.V1.encode(new AcidOutputFormat.Options(hiveConf).bucket(bucketId));
    Object bucketProperty = ((Object[]) row)[2];
    if (bucketProperty instanceof Writable) {
      ((IntWritable) bucketProperty).set(encodedBucketValue);
    } else {
      ((Object[]) row)[2] = encodedBucketValue;
    }
  }
Required for rebalancing compaction. Encodes the raw bucket property set by the compactor
@param row The acid row in which the bucket needs to be updated.
ql/src/java/org/apache/hadoop/hive/ql/exec/FileSinkOperator.java