use of org.apache.hadoop.hive.common.ValidReaderWriteIdList in project hive by apache.
the class TestAcidUtils method testObsoleteOriginals.
@Test
public void testObsoleteOriginals() throws Exception {
Configuration conf = new Configuration();
MockFileSystem fs = new MockFileSystem(conf, new MockFile("mock:/tbl/part1/base_10/bucket_0", 500, new byte[0]), new MockFile("mock:/tbl/part1/base_5/bucket_0", 500, new byte[0]), new MockFile("mock:/tbl/part1/000000_0", 500, new byte[0]), new MockFile("mock:/tbl/part1/000001_1", 500, new byte[0]));
Path part = new MockPath(fs, "/tbl/part1");
AcidUtils.Directory dir = AcidUtils.getAcidState(part, conf, new ValidReaderWriteIdList("tbl:150:" + Long.MAX_VALUE + ":"));
// Obsolete list should include the two original bucket files, and the old base dir
List<FileStatus> obsolete = dir.getObsolete();
assertEquals(3, obsolete.size());
assertEquals("mock:/tbl/part1/base_5", obsolete.get(0).getPath().toString());
assertEquals("mock:/tbl/part1/base_10", dir.getBaseDirectory().toString());
}
use of org.apache.hadoop.hive.common.ValidReaderWriteIdList in project hive by apache.
the class TestAcidUtils method deltasWithOpenTxnInRead2.
/**
* @since 1.3.0
* @throws Exception
*/
@Test
public void deltasWithOpenTxnInRead2() throws Exception {
Configuration conf = new Configuration();
MockFileSystem fs = new MockFileSystem(conf, new MockFile("mock:/tbl/part1/delta_1_1/bucket_0", 500, new byte[0]), new MockFile("mock:/tbl/part1/delta_2_5/bucket_0", 500, new byte[0]), new MockFile("mock:/tbl/part1/delta_4_4_1/bucket_0", 500, new byte[0]), new MockFile("mock:/tbl/part1/delta_4_4_3/bucket_0", 500, new byte[0]), new MockFile("mock:/tbl/part1/delta_101_101_1/bucket_0", 500, new byte[0]));
Path part = new MockPath(fs, "mock:/tbl/part1");
AcidUtils.Directory dir = AcidUtils.getAcidState(part, conf, new ValidReaderWriteIdList("tbl:100:4:4"));
List<AcidUtils.ParsedDelta> delts = dir.getCurrentDirectories();
assertEquals(2, delts.size());
assertEquals("mock:/tbl/part1/delta_1_1", delts.get(0).getPath().toString());
assertEquals("mock:/tbl/part1/delta_2_5", delts.get(1).getPath().toString());
}
use of org.apache.hadoop.hive.common.ValidReaderWriteIdList in project hive by apache.
the class TestAcidUtils method deltasWithOpenTxnInRead.
@Test
public void deltasWithOpenTxnInRead() throws Exception {
Configuration conf = new Configuration();
MockFileSystem fs = new MockFileSystem(conf, new MockFile("mock:/tbl/part1/delta_1_1/bucket_0", 500, new byte[0]), new MockFile("mock:/tbl/part1/delta_2_5/bucket_0", 500, new byte[0]));
Path part = new MockPath(fs, "mock:/tbl/part1");
AcidUtils.Directory dir = AcidUtils.getAcidState(part, conf, new ValidReaderWriteIdList("tbl:100:4:4"));
List<AcidUtils.ParsedDelta> delts = dir.getCurrentDirectories();
assertEquals(2, delts.size());
assertEquals("mock:/tbl/part1/delta_1_1", delts.get(0).getPath().toString());
assertEquals("mock:/tbl/part1/delta_2_5", delts.get(1).getPath().toString());
}
use of org.apache.hadoop.hive.common.ValidReaderWriteIdList in project hive by apache.
the class TestAcidUtils method testOverlapingDelta2.
/**
* Hive 1.3.0 delta dir naming scheme which supports multi-statement txns
* @throws Exception
*/
@Test
public void testOverlapingDelta2() throws Exception {
Configuration conf = new Configuration();
MockFileSystem fs = new MockFileSystem(conf, new MockFile("mock:/tbl/part1/delta_0000063_63_0/bucket_0", 500, new byte[0]), new MockFile("mock:/tbl/part1/delta_000062_62_0/bucket_0", 500, new byte[0]), new MockFile("mock:/tbl/part1/delta_000062_62_3/bucket_0", 500, new byte[0]), new MockFile("mock:/tbl/part1/delta_00061_61_0/bucket_0", 500, new byte[0]), new MockFile("mock:/tbl/part1/delta_40_60/bucket_0", 500, new byte[0]), new MockFile("mock:/tbl/part1/delta_0060_60_1/bucket_0", 500, new byte[0]), new MockFile("mock:/tbl/part1/delta_0060_60_4/bucket_0", 500, new byte[0]), new MockFile("mock:/tbl/part1/delta_0060_60_7/bucket_0", 500, new byte[0]), new MockFile("mock:/tbl/part1/delta_052_55/bucket_0", 500, new byte[0]), new MockFile("mock:/tbl/part1/delta_058_58/bucket_0", 500, new byte[0]), new MockFile("mock:/tbl/part1/base_50/bucket_0", 500, new byte[0]));
Path part = new MockPath(fs, "mock:/tbl/part1");
AcidUtils.Directory dir = AcidUtils.getAcidState(part, conf, new ValidReaderWriteIdList("tbl:100:" + Long.MAX_VALUE + ":"));
assertEquals("mock:/tbl/part1/base_50", dir.getBaseDirectory().toString());
List<FileStatus> obsolete = dir.getObsolete();
assertEquals(5, obsolete.size());
assertEquals("mock:/tbl/part1/delta_052_55", obsolete.get(0).getPath().toString());
assertEquals("mock:/tbl/part1/delta_058_58", obsolete.get(1).getPath().toString());
assertEquals("mock:/tbl/part1/delta_0060_60_1", obsolete.get(2).getPath().toString());
assertEquals("mock:/tbl/part1/delta_0060_60_4", obsolete.get(3).getPath().toString());
assertEquals("mock:/tbl/part1/delta_0060_60_7", obsolete.get(4).getPath().toString());
List<AcidUtils.ParsedDelta> delts = dir.getCurrentDirectories();
assertEquals(5, delts.size());
assertEquals("mock:/tbl/part1/delta_40_60", delts.get(0).getPath().toString());
assertEquals("mock:/tbl/part1/delta_00061_61_0", delts.get(1).getPath().toString());
assertEquals("mock:/tbl/part1/delta_000062_62_0", delts.get(2).getPath().toString());
assertEquals("mock:/tbl/part1/delta_000062_62_3", delts.get(3).getPath().toString());
assertEquals("mock:/tbl/part1/delta_0000063_63_0", delts.get(4).getPath().toString());
}
use of org.apache.hadoop.hive.common.ValidReaderWriteIdList in project hive by apache.
the class TestAcidUtils method testOverlapingDelta.
@Test
public void testOverlapingDelta() throws Exception {
Configuration conf = new Configuration();
MockFileSystem fs = new MockFileSystem(conf, new MockFile("mock:/tbl/part1/delta_0000063_63/bucket_0", 500, new byte[0]), new MockFile("mock:/tbl/part1/delta_000062_62/bucket_0", 500, new byte[0]), new MockFile("mock:/tbl/part1/delta_00061_61/bucket_0", 500, new byte[0]), new MockFile("mock:/tbl/part1/delta_40_60/bucket_0", 500, new byte[0]), new MockFile("mock:/tbl/part1/delta_0060_60/bucket_0", 500, new byte[0]), new MockFile("mock:/tbl/part1/delta_052_55/bucket_0", 500, new byte[0]), new MockFile("mock:/tbl/part1/base_50/bucket_0", 500, new byte[0]));
Path part = new MockPath(fs, "mock:/tbl/part1");
AcidUtils.Directory dir = AcidUtils.getAcidState(part, conf, new ValidReaderWriteIdList("tbl:100:" + Long.MAX_VALUE + ":"));
assertEquals("mock:/tbl/part1/base_50", dir.getBaseDirectory().toString());
List<FileStatus> obsolete = dir.getObsolete();
assertEquals(2, obsolete.size());
assertEquals("mock:/tbl/part1/delta_052_55", obsolete.get(0).getPath().toString());
assertEquals("mock:/tbl/part1/delta_0060_60", obsolete.get(1).getPath().toString());
List<AcidUtils.ParsedDelta> delts = dir.getCurrentDirectories();
assertEquals(4, delts.size());
assertEquals("mock:/tbl/part1/delta_40_60", delts.get(0).getPath().toString());
assertEquals("mock:/tbl/part1/delta_00061_61", delts.get(1).getPath().toString());
assertEquals("mock:/tbl/part1/delta_000062_62", delts.get(2).getPath().toString());
assertEquals("mock:/tbl/part1/delta_0000063_63", delts.get(3).getPath().toString());
}
Aggregations