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

Method testBinStorageGetSchema

test/org/apache/pig/test/TestStore.java:323–348  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

321 br.close();
322 }
323 @Test
324 public void testBinStorageGetSchema() throws IOException, ParserException {
325 String input[] = new String[] { "hello\t1\t10.1", "bye\t2\t20.2" };
326 String inputFileName = "testGetSchema-input.txt";
327 String outputFileName = "testGetSchema-output.txt";
328 try {
329 Util.createInputFile(ps.getPigContext(),
330 inputFileName, input);
331 String query = "a = load '" + inputFileName + "' as (c:chararray, " +
332 "i:int,d:double);store a into '" + outputFileName + "' using " +
333 "BinStorage();";
334 ps.setBatchOn();
335 Util.registerMultiLineQuery(ps, query);
336 ps.executeBatch();
337 ResourceSchema rs = new BinStorage().getSchema(outputFileName,
338 new Job(ConfigurationUtil.toConfiguration(ps.getPigContext().
339 getProperties())));
340 Schema expectedSchema = Utils.getSchemaFromString(
341 "c:chararray,i:int,d:double");
342 assertTrue("Checking binstorage getSchema output", Schema.equals(
343 expectedSchema, Schema.getPigSchema(rs), true, true));
344 } finally {
345 Util.deleteFile(ps.getPigContext(), inputFileName);
346 Util.deleteFile(ps.getPigContext(), outputFileName);
347 }
348 }
349
350 @Test
351 public void testStoreRemoteRel() throws Exception {

Callers

nothing calls this directly

Calls 12

createInputFileMethod · 0.95
toConfigurationMethod · 0.95
getSchemaFromStringMethod · 0.95
equalsMethod · 0.95
getPigSchemaMethod · 0.95
deleteFileMethod · 0.95
getSchemaMethod · 0.65
getPigContextMethod · 0.45
setBatchOnMethod · 0.45
executeBatchMethod · 0.45
getPropertiesMethod · 0.45

Tested by

no test coverage detected