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

Method testDefaultJoin

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

Source from the content-addressed store, hash-verified

59 }
60
61 @Test
62 public void testDefaultJoin() throws Exception {
63 String[] input1 = {
64 "hello\t1",
65 "bye\t2",
66 "\t3"
67 };
68 String[] input2 = {
69 "hello\tworld",
70 "good\tmorning",
71 "\tevening"
72 };
73
74 String firstInput = createInputFile("a.txt", input1);
75 String secondInput = createInputFile("b.txt", input2);
76 Tuple expectedResult = (Tuple)Util.getPigConstant("('hello',1,'hello','world')");
77
78 // with schema
79 String script = "a = load '"+ Util.encodeEscape(firstInput) +"' as (n:chararray, a:int); " +
80 "b = load '"+ Util.encodeEscape(secondInput) +"' as (n:chararray, m:chararray); " +
81 "c = join a by $0, b by $0;";
82 Util.registerMultiLineQuery(pigServer, script);
83 Iterator<Tuple> it = pigServer.openIterator("c");
84 assertTrue(it.hasNext());
85 assertEquals(expectedResult, it.next());
86 assertFalse(it.hasNext());
87
88 // without schema
89 script = "a = load '"+ Util.encodeEscape(firstInput) + "'; " +
90 "b = load '" + Util.encodeEscape(secondInput) + "'; " +
91 "c = join a by $0, b by $0;";
92 Util.registerMultiLineQuery(pigServer, script);
93 it = pigServer.openIterator("c");
94 assertTrue(it.hasNext());
95 assertEquals(expectedResult.toString(), it.next().toString());
96 assertFalse(it.hasNext());
97 deleteInputFile(firstInput);
98 deleteInputFile(secondInput);
99 }
100
101
102 @Test

Callers

nothing calls this directly

Calls 10

createInputFileMethod · 0.95
getPigConstantMethod · 0.95
encodeEscapeMethod · 0.95
deleteInputFileMethod · 0.95
openIteratorMethod · 0.80
hasNextMethod · 0.45
assertEqualsMethod · 0.45
nextMethod · 0.45
toStringMethod · 0.45

Tested by

no test coverage detected