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

Method genDataSetFile

test/org/apache/pig/test/TestLocal2.java:263–307  ·  view source on GitHub ↗

For generating a sample dataset

(boolean hasNulls, int dataLength )

Source from the content-addressed store, hash-verified

261 * For generating a sample dataset
262 */
263 private File genDataSetFile(boolean hasNulls, int dataLength ) throws IOException {
264
265 String[][] data = new String[dataLength][] ;
266
267 DecimalFormat formatter = new DecimalFormat("0000000");
268
269 if ( hasNulls == true ) {
270
271 for (int i = 0; i < dataLength; i++) {
272
273 data[i] = new String[2] ;
274 if ( i % 7 == 0 ) {
275 data[i][0] = "";
276 data[i][1] = formatter.format(dataLength - i);
277
278 } else if ( i % 10 ==0 ) {
279
280 data[i][0] = formatter.format(i % 10);
281 data[i][1] = "";
282
283 } else if ( i % 13 == 0 ) {
284
285 data[i][0] = "";
286 data[i][1] = "";
287
288 } else {
289 data[i][0] = formatter.format(i % 10);
290 data[i][1] = formatter.format(dataLength - i);
291 }
292 }
293
294 } else {
295
296
297 for (int i = 0; i < dataLength; i++) {
298 data[i] = new String[2] ;
299 data[i][0] = formatter.format(i % 10);
300 data[i][1] = formatter.format(dataLength - i);
301 }
302
303 }
304 File tmpFile = TestHelper.createTempFile(data) ;
305 tmpFile.deleteOnExit();
306 return tmpFile;
307 }
308}

Callers 4

testUnion1Method · 0.95
testUnion1WithNullsMethod · 0.95
testUnion2Method · 0.95
testUnion2WithNullsMethod · 0.95

Calls 2

createTempFileMethod · 0.95
formatMethod · 0.45

Tested by

no test coverage detected