@Override public void run() { pfs.addPartition(KEY_4, path3); } });
@Override public void run() { pfs.addPartition(KEY_1, path3); } });
@Override public void run() { pfs.addPartition(KEY_3, path3); throw new RuntimeException("fail the tx"); } });
@Override public void apply() throws Exception { Assert.assertTrue(pfsBaseLocation.exists()); // attempt to write a new partition - should fail try { pfs.getPartitionOutput(PARTITION_KEY); Assert.fail("External partitioned file set should not allow writing files"); } catch (UnsupportedOperationException e) { // expected } // create an external file and add it as a partition File someFile = new File(absolutePath, "some.file"); OutputStream out = new FileOutputStream(someFile); out.close(); Assert.assertTrue(someFile.exists()); pfs.addPartition(PARTITION_KEY, "some.file"); Assert.assertNotNull(pfs.getPartition(PARTITION_KEY)); Assert.assertTrue(pfs.getPartition(PARTITION_KEY).getLocation().exists()); // now drop the partition and validate the file is still there pfs.dropPartition(PARTITION_KEY); Assert.assertNull(pfs.getPartition(PARTITION_KEY)); Assert.assertTrue(someFile.exists()); } });
writer.write("2,2\n"); pfs.addPartition(KEY_2, path2);
writer.write("1,x\n"); pfs.get().addPartition(PartitionKey.builder().addStringField("x", "1").build(), "some/path"); pfs.flush();
pfs.addPartition( PartitionKey.builder().addField("i", 1).addField("l", "2").addField("s", "a").build(), "some/location"); pfs.addPartition( PartitionKey.builder().addField("i", 1).addField("l", 2L).addField("s", "a").addField("x", "x").build(), "some/location", ImmutableMap.of("a", "b")); pfs.addPartition( PartitionKey.builder().addField("i", 1).addField("l", 2L).addField("s", "a").build(), "some/location", ImmutableMap.of("a", "b"));