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

Method testLoadingMultipleFiles

test/org/apache/pig/test/TestLoad.java:262–298  ·  view source on GitHub ↗
(String[] inputFileNames,
            String loadLocationString)

Source from the content-addressed store, hash-verified

260 }
261
262 @SuppressWarnings("unchecked")
263 private void testLoadingMultipleFiles(String[] inputFileNames,
264 String loadLocationString) throws IOException, ParserException {
265
266 String[][] inputStrings = new String[][] {
267 new String[] { "hello\tworld"},
268 new String[] { "bye\tnow"},
269 new String[] { "all\tgood"}
270 };
271 List<Tuple> expected = Arrays.asList(new Tuple[] {
272 (Tuple) Util.getPigConstant("('hello', 'world')"),
273 (Tuple) Util.getPigConstant("('bye', 'now')"),
274 (Tuple) Util.getPigConstant("('all', 'good')")});
275
276 List<Tuple> expectedBasedOnNumberOfInputs = new ArrayList<Tuple>();
277 for(int i = 0; i < inputFileNames.length; i++) {
278 Util.createInputFile(pc, inputFileNames[i], inputStrings[i]);
279 expectedBasedOnNumberOfInputs.add(expected.get(i));
280 }
281 try {
282 servers[0].registerQuery(" a = load '" + loadLocationString + "' as " +
283 "(s1:chararray, s2:chararray);");
284 Iterator<Tuple> it = servers[0].openIterator("a");
285
286 List<Tuple> actual = new ArrayList<Tuple>();
287 while(it.hasNext()) {
288 actual.add(it.next());
289 }
290 Collections.sort(expectedBasedOnNumberOfInputs);
291 Collections.sort(actual);
292 assertEquals(expectedBasedOnNumberOfInputs, actual);
293 } finally {
294 for(int i = 0; i < inputFileNames.length; i++) {
295 Util.deleteFile(pc, inputFileNames[i]);
296 }
297 }
298 }
299
300 private void checkLoadPath(String orig, String expected) throws Exception {
301 checkLoadPath(orig, expected, false);

Callers 3

Calls 11

getPigConstantMethod · 0.95
createInputFileMethod · 0.95
deleteFileMethod · 0.95
openIteratorMethod · 0.80
sortMethod · 0.80
addMethod · 0.65
getMethod · 0.65
registerQueryMethod · 0.45
hasNextMethod · 0.45
nextMethod · 0.45
assertEqualsMethod · 0.45

Tested by

no test coverage detected