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

Method testJoinTupleFieldKey

test/org/apache/pig/test/TestJoinBase.java:361–390  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

359
360
361 @Test
362 public void testJoinTupleFieldKey() throws Exception{
363 String[] input1 = {
364 "(1,a)",
365 "(2,aa)"
366 };
367 String[] input2 = {
368 "(1,b)",
369 "(2,bb)"
370 };
371
372 String firstInput = createInputFile("a.txt", input1);
373 String secondInput = createInputFile("b.txt", input2);
374
375 String script = "a = load '"+ Util.encodeEscape(firstInput) +"' as (a:tuple(a1:int, a2:chararray));" +
376 "b = load '"+ Util.encodeEscape(secondInput) +"' as (b:tuple(b1:int, b2:chararray));" +
377 "c = join a by a.a1, b by b.b1;";
378 Util.registerMultiLineQuery(pigServer, script);
379 Iterator<Tuple> it = pigServer.openIterator("c");
380
381 List<Tuple> expectedResults = Util.getTuplesFromConstantTupleStrings(
382 new String[] {
383 "((1,'a'),(1,'b'))",
384 "((2,'aa'),(2,'bb'))"
385 });
386 Util.checkQueryOutputsAfterSort(it, expectedResults);
387
388 deleteInputFile(firstInput);
389 deleteInputFile(secondInput);
390 }
391
392 @Test
393 public void testJoinNullTupleFieldKey() throws Exception{

Callers

nothing calls this directly

Calls 7

createInputFileMethod · 0.95
encodeEscapeMethod · 0.95
deleteInputFileMethod · 0.95
openIteratorMethod · 0.80

Tested by

no test coverage detected