Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Test
- public void testFiltering() throws ExecException {
- String[] expected = {
- "(4,323,242,http://www.google.com/url&url=http%3A%2F%2Fwww.tagesschau.de&q=barack%20obama)",
- "(5,423,342,http://www.google.com/url&url=http%3A%2F%2Fwww.bild.de&q=obama)"
- };
- pigServer = new PigServer(ExecType.LOCAL);
- try {
- Util.registerMultiLineQuery(pigServer, "a = LOAD '" + INPUT_FILE +
- "' AS (id:int, grp:int, additional:int, referer:chararray); " +
- "b = FILTER a BY " +
- "com.adition.pig.filtering.string.CONTAINS(referer, 'obama');");
- Iterator<Tuple> iter = pigServer.openIterator("b");
- int counter = 0;
- while (iter.hasNext()){
- assertEquals(expected[counter++].toString(), iter.next().toString());
- }
- assertEquals(expected.length, counter);
- } catch (Exception e) {
- e.printStackTrace();
- Assert.fail();
- }
- pigServer.shutdown();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement