MCPcopy Create free account
hub / github.com/apache/pig / testWithBincond

Method testWithBincond

test/org/apache/pig/test/TestIn.java:68–92  ·  view source on GitHub ↗

Verify that IN operator works with ? operator. @throws Exception

()

Source from the content-addressed store, hash-verified

66 * @throws Exception
67 */
68 @Test
69 public void testWithBincond() throws Exception {
70 PigServer pigServer = new PigServer(Util.getLocalTestMode());
71 Data data = resetData(pigServer);
72
73 data.set("foo",
74 tuple(1),
75 tuple(2),
76 tuple(3),
77 tuple(4),
78 tuple(5)
79 );
80
81 pigServer.registerQuery("A = LOAD 'foo' USING mock.Storage() AS (i:int);");
82 pigServer.registerQuery("B = FOREACH A GENERATE (i IN (1, 3, 5) ? 'ODD' : 'EVEN');");
83 pigServer.registerQuery("STORE B INTO 'bar' USING mock.Storage();");
84
85 List<Tuple> out = data.get("bar");
86 assertEquals(5, out.size());
87 assertEquals(tuple("ODD"), out.get(0));
88 assertEquals(tuple("EVEN"), out.get(1));
89 assertEquals(tuple("ODD"), out.get(2));
90 assertEquals(tuple("EVEN"), out.get(3));
91 assertEquals(tuple("ODD"), out.get(4));
92 }
93
94 /**
95 * Verify that IN operator works with SPLIT.

Callers

nothing calls this directly

Calls 9

getLocalTestModeMethod · 0.95
setMethod · 0.95
registerQueryMethod · 0.95
getMethod · 0.95
resetDataMethod · 0.80
sizeMethod · 0.65
getMethod · 0.65
tupleMethod · 0.45
assertEqualsMethod · 0.45

Tested by

no test coverage detected