Search in sources :

Example 11 with ValidCompactorTxnList

use of org.apache.hadoop.hive.common.ValidCompactorTxnList in project hive by apache.

the class TestValidCompactorTxnList method writeToString.

@Test
public void writeToString() {
    ValidTxnList txns = new ValidCompactorTxnList(new long[] { 9, 7, 10, Long.MAX_VALUE }, 8);
    Assert.assertEquals("8:" + Long.MAX_VALUE + ":7", txns.writeToString());
    txns = new ValidCompactorTxnList();
    Assert.assertEquals(Long.toString(Long.MAX_VALUE) + ":" + Long.MAX_VALUE + ":", txns.writeToString());
    txns = new ValidCompactorTxnList(new long[0], 23);
    Assert.assertEquals("23:" + Long.MAX_VALUE + ":", txns.writeToString());
}
Also used : ValidTxnList(org.apache.hadoop.hive.common.ValidTxnList) ValidCompactorTxnList(org.apache.hadoop.hive.common.ValidCompactorTxnList) Test(org.junit.Test)

Example 12 with ValidCompactorTxnList

use of org.apache.hadoop.hive.common.ValidCompactorTxnList in project hive by apache.

the class TestValidCompactorTxnList method exceptionsInMidst.

@Test
public void exceptionsInMidst() {
    ValidTxnList txns = new ValidCompactorTxnList(new long[] { 8 }, 7);
    ValidTxnList.RangeResponse rsp = txns.isTxnRangeValid(7, 9);
    Assert.assertEquals(ValidTxnList.RangeResponse.NONE, rsp);
}
Also used : ValidTxnList(org.apache.hadoop.hive.common.ValidTxnList) ValidCompactorTxnList(org.apache.hadoop.hive.common.ValidCompactorTxnList) Test(org.junit.Test)

Example 13 with ValidCompactorTxnList

use of org.apache.hadoop.hive.common.ValidCompactorTxnList in project hive by apache.

the class TestValidCompactorTxnList method exceptionsAbveHighWaterMark.

@Test
public void exceptionsAbveHighWaterMark() {
    ValidTxnList txns = new ValidCompactorTxnList(new long[] { 8, 11, 17, 29 }, 15);
    Assert.assertArrayEquals("", new long[] { 8, 11 }, txns.getInvalidTransactions());
    ValidTxnList.RangeResponse rsp = txns.isTxnRangeValid(7, 9);
    Assert.assertEquals(ValidTxnList.RangeResponse.ALL, rsp);
    rsp = txns.isTxnRangeValid(12, 16);
    Assert.assertEquals(ValidTxnList.RangeResponse.NONE, rsp);
}
Also used : ValidTxnList(org.apache.hadoop.hive.common.ValidTxnList) ValidCompactorTxnList(org.apache.hadoop.hive.common.ValidCompactorTxnList) Test(org.junit.Test)

Aggregations

ValidCompactorTxnList (org.apache.hadoop.hive.common.ValidCompactorTxnList)13 Test (org.junit.Test)12 ValidTxnList (org.apache.hadoop.hive.common.ValidTxnList)8 Configuration (org.apache.hadoop.conf.Configuration)3 Path (org.apache.hadoop.fs.Path)3 MockFile (org.apache.hadoop.hive.ql.io.orc.TestInputOutputFormat.MockFile)3 MockFileSystem (org.apache.hadoop.hive.ql.io.orc.TestInputOutputFormat.MockFileSystem)3 MockPath (org.apache.hadoop.hive.ql.io.orc.TestInputOutputFormat.MockPath)3 TxnInfo (org.apache.hadoop.hive.metastore.api.TxnInfo)1