use of org.apache.hadoop.hive.ql.io.orc.TestInputOutputFormat.MockPath 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 ValidReadTxnList("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.ql.io.orc.TestInputOutputFormat.MockPath 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 ValidReadTxnList("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.ql.io.orc.TestInputOutputFormat.MockPath 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 ValidReadTxnList("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.ql.io.orc.TestInputOutputFormat.MockPath in project hive by apache.
the class TestAcidUtils method testOriginal.
@Test
public void testOriginal() throws Exception {
Configuration conf = new Configuration();
MockFileSystem fs = new MockFileSystem(conf, new MockFile("mock:/tbl/part1/000000_0", 500, new byte[0]), new MockFile("mock:/tbl/part1/000001_1", 500, new byte[0]), new MockFile("mock:/tbl/part1/000002_0", 500, new byte[0]), new MockFile("mock:/tbl/part1/random", 500, new byte[0]), new MockFile("mock:/tbl/part1/_done", 0, new byte[0]), new MockFile("mock:/tbl/part1/subdir/000000_0", 0, new byte[0]));
AcidUtils.Directory dir = AcidUtils.getAcidState(new MockPath(fs, "/tbl/part1"), conf, new ValidReadTxnList("100:" + Long.MAX_VALUE + ":"));
assertEquals(null, dir.getBaseDirectory());
assertEquals(0, dir.getCurrentDirectories().size());
assertEquals(0, dir.getObsolete().size());
List<HdfsFileStatusWithId> result = dir.getOriginalFiles();
assertEquals(5, result.size());
assertEquals("mock:/tbl/part1/000000_0", result.get(0).getFileStatus().getPath().toString());
assertEquals("mock:/tbl/part1/000001_1", result.get(1).getFileStatus().getPath().toString());
assertEquals("mock:/tbl/part1/000002_0", result.get(2).getFileStatus().getPath().toString());
assertEquals("mock:/tbl/part1/random", result.get(3).getFileStatus().getPath().toString());
assertEquals("mock:/tbl/part1/subdir/000000_0", result.get(4).getFileStatus().getPath().toString());
}
use of org.apache.hadoop.hive.ql.io.orc.TestInputOutputFormat.MockPath in project hive by apache.
the class TestAcidUtils method testMinorCompactedDeltaMakesInBetweenDelteDeltaObsolete.
@Test
public void testMinorCompactedDeltaMakesInBetweenDelteDeltaObsolete() throws Exception {
// This test checks that if we have a minor compacted delta for the txn range [40,60]
// then it will make any delete delta in that range as obsolete.
Configuration conf = new Configuration();
conf.setInt(HiveConf.ConfVars.HIVE_TXN_OPERATIONAL_PROPERTIES.varname, AcidUtils.AcidOperationalProperties.getDefault().toInt());
MockFileSystem fs = new MockFileSystem(conf, new MockFile("mock:/tbl/part1/delta_40_60/bucket_0", 500, new byte[0]), new MockFile("mock:/tbl/part1/delete_delta_50_50/bucket_0", 500, new byte[0]));
Path part = new MockPath(fs, "mock:/tbl/part1");
AcidUtils.Directory dir = AcidUtils.getAcidState(part, conf, new ValidReadTxnList("100:" + Long.MAX_VALUE + ":"));
List<FileStatus> obsolete = dir.getObsolete();
assertEquals(1, obsolete.size());
assertEquals("mock:/tbl/part1/delete_delta_50_50", obsolete.get(0).getPath().toString());
List<AcidUtils.ParsedDelta> delts = dir.getCurrentDirectories();
assertEquals(1, delts.size());
assertEquals("mock:/tbl/part1/delta_40_60", delts.get(0).getPath().toString());
}
Aggregations