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

Method testBag

test/org/apache/pig/test/TestTextDataParser.java:216–232  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

214 }
215
216 @Test
217 public void testBag() throws Exception{
218 String myBag = "{(1,a),(2,b)}";
219 Object o = ps.getLoadCaster().bytesToBag(myBag.getBytes(), getBagFieldSchema());
220 assertTrue(o instanceof DataBag);
221 DataBag b = (DataBag)o;
222 DataBag expectedBag = bagFactory.newDefaultBag();
223 Tuple expectedTuple = tupleFactory.newTuple(2);
224 expectedTuple.set(0, 1);
225 expectedTuple.set(1, "a");
226 expectedBag.add(expectedTuple);
227 expectedTuple = tupleFactory.newTuple(2);
228 expectedTuple.set(0, 2);
229 expectedTuple.set(1, "b");
230 expectedBag.add(expectedTuple);
231 assertEquals(expectedBag, b);
232 }
233
234 @Test
235 public void testEmptyBag() throws Exception{

Callers

nothing calls this directly

Calls 9

getBagFieldSchemaMethod · 0.95
setMethod · 0.95
addMethod · 0.95
bytesToBagMethod · 0.65
getLoadCasterMethod · 0.65
getBytesMethod · 0.65
newTupleMethod · 0.65
newDefaultBagMethod · 0.45
assertEqualsMethod · 0.45

Tested by

no test coverage detected