@Test
  public void testGetBucketCodecVersion1() {
    final BucketCodec codec = BucketCodec.getCodec(1);
    assertEquals(BucketCodec.V1, codec);
    assertEquals(1, codec.getVersion());

    assertEquals(2748, codec.decodeWriterId(0x0ABC0000));

    assertEquals(2748, codec.decodeStatementId(0x00000ABC));

    final AcidOutputFormat.Options options = new AcidOutputFormat.Options(null).bucket(7).statementId(16);
    assertEquals(537329680, codec.encode(options));

    // Statement ID of -1 is acceptable and has the same affect as a value of 0
    final AcidOutputFormat.Options optionsNeg = new AcidOutputFormat.Options(null).bucket(7).statementId(-1);
    final AcidOutputFormat.Options optionsZero = new AcidOutputFormat.Options(null).bucket(7).statementId(0);
    assertEquals(codec.encode(optionsZero), codec.encode(optionsNeg));
  }
Test Bucket Codec version 1. Represents format of "bucket" property in Hive
3.0.
ql/src/test/org/apache/hadoop/hive/ql/io/TestBucketCodec.java