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

Method testUniqueID

test/org/apache/pig/test/TestBuiltin.java:3234–3262  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

3232 }
3233
3234 @Test
3235 public void testUniqueID() throws Exception {
3236 Util.resetStateForExecModeSwitch();
3237 Properties copyproperties = new Properties();
3238 copyproperties.putAll(cluster.getProperties());
3239 PigServer pigServer = new PigServer(cluster.getExecType(), copyproperties);
3240
3241 // running with 2 mappers each taking 5 records
3242 String TMP_DIR = FileLocalizer.getTemporaryPath(pigServer.getPigContext()).toUri().getPath();
3243 Util.createInputFile(cluster, TMP_DIR + "/input1.txt", new String[] {"1\n2\n3\n4\n5"});
3244 Util.createInputFile(cluster, TMP_DIR + "/input2.txt", new String[] {"1\n2\n3\n4\n5"});
3245 pigServer.getPigContext().getProperties().setProperty("pig.noSplitCombination", "true");
3246
3247 pigServer.registerQuery("A = load '" + TMP_DIR + "' as (name);");
3248 pigServer.registerQuery("B = foreach A generate name, UniqueID();");
3249 Iterator<Tuple> iter = pigServer.openIterator("B");
3250 assertEquals("0-0",iter.next().get(1));
3251 assertEquals("0-1",iter.next().get(1));
3252 assertEquals("0-2",iter.next().get(1));
3253 assertEquals("0-3",iter.next().get(1));
3254 assertEquals("0-4",iter.next().get(1));
3255 assertEquals("1-0",iter.next().get(1));
3256 assertEquals("1-1",iter.next().get(1));
3257 assertEquals("1-2",iter.next().get(1));
3258 assertEquals("1-3",iter.next().get(1));
3259 assertEquals("1-4",iter.next().get(1));
3260 Util.deleteFile(cluster, TMP_DIR + "/input1.txt");
3261 Util.deleteFile(cluster, TMP_DIR + "/input2.txt");
3262 }
3263
3264 @Test
3265 public void testRANDOMWithJob() throws Exception {

Callers

nothing calls this directly

Calls 15

getTemporaryPathMethod · 0.95
getPigContextMethod · 0.95
createInputFileMethod · 0.95
registerQueryMethod · 0.95
openIteratorMethod · 0.95
deleteFileMethod · 0.95
putAllMethod · 0.80
setPropertyMethod · 0.65
getMethod · 0.65
getPropertiesMethod · 0.45
getExecTypeMethod · 0.45

Tested by

no test coverage detected