Verify that ASSERT operator works @throws Exception
()
| 40 | * @throws Exception |
| 41 | */ |
| 42 | @Test |
| 43 | public void testPositive() throws Exception { |
| 44 | PigServer pigServer = new PigServer(Util.getLocalTestMode()); |
| 45 | Data data = resetData(pigServer); |
| 46 | |
| 47 | data.set("foo", |
| 48 | tuple(1), |
| 49 | tuple(2), |
| 50 | tuple(3) |
| 51 | ); |
| 52 | |
| 53 | pigServer.setBatchOn(); |
| 54 | pigServer.registerQuery("A = LOAD 'foo' USING mock.Storage() AS (i:int);"); |
| 55 | pigServer.registerQuery("ASSERT A BY i > 0;"); |
| 56 | pigServer.registerQuery("STORE A INTO 'bar' USING mock.Storage();"); |
| 57 | |
| 58 | pigServer.executeBatch(); |
| 59 | |
| 60 | List<Tuple> out = data.get("bar"); |
| 61 | assertEquals(3, out.size()); |
| 62 | assertEquals(tuple(1), out.get(0)); |
| 63 | assertEquals(tuple(2), out.get(1)); |
| 64 | assertEquals(tuple(3), out.get(2)); |
| 65 | } |
| 66 | |
| 67 | /** |
| 68 | * Verify that ASSERT operator works in a Pig script |
nothing calls this directly
no test coverage detected