@Test (timeout = 5000) public void testNonFileSplits() throws IOException { HostAffinitySplitLocationProvider locationProvider = new HostAffinitySplitLocationProvider(executorLocations); InputSplit inputSplit1 = createMockInputSplit(new String[] {locations.get(0), locations.get(1)}); InputSplit inputSplit2 = createMockInputSplit(new String[] {locations.get(2), locations.get(3)}); assertArrayEquals(new String[] {locations.get(0), locations.get(1)}, locationProvider.getLocations(inputSplit1)); assertArrayEquals(new String[] {locations.get(2), locations.get(3)}, locationProvider.getLocations(inputSplit2)); }
@Test (timeout = 5000) public void testOrcSplitsBasic() throws IOException { HostAffinitySplitLocationProvider locationProvider = new HostAffinitySplitLocationProvider(executorLocations); InputSplit os1 = createMockFileSplit(true, "path1", 0, 1000, new String[] {locations.get(0), locations.get(1)}); InputSplit os2 = createMockFileSplit(true, "path2", 0, 2000, new String[] {locations.get(2), locations.get(3)}); InputSplit os3 = createMockFileSplit(true, "path3", 1000, 2000, new String[] {locations.get(0), locations.get(3)}); String[] retLoc1 = locationProvider.getLocations(os1); String[] retLoc2 = locationProvider.getLocations(os2); String[] retLoc3 = locationProvider.getLocations(os3); assertEquals(1, retLoc1.length); assertFalse(locationsSet.contains(retLoc1[0])); assertTrue(executorLocationsSet.contains(retLoc1[0])); assertEquals(1, retLoc2.length); assertFalse(locationsSet.contains(retLoc2[0])); assertTrue(executorLocationsSet.contains(retLoc2[0])); assertEquals(1, retLoc3.length); assertFalse(locationsSet.contains(retLoc3[0])); assertTrue(executorLocationsSet.contains(retLoc3[0])); }
String[] retLoc11 = locationProvider.getLocations(os11); String[] retLoc12 = locationProvider.getLocations(os12); String[] retLoc13 = locationProvider.getLocations(os13); String[] retLoc112 = locationProvider.getLocations(os11); String[] retLoc122 = locationProvider.getLocations(os12); String[] retLoc132 = locationProvider.getLocations(os13); assertArrayEquals(retLoc11, retLoc112); assertArrayEquals(retLoc12, retLoc122);
String newNode = partLoc.get(locs - 1); for (int splitIx = 0; splitIx < splits.length; ++splitIx) { String[] splitLocations = lp.getLocations(splits[splitIx]); assertEquals(1, splitLocations.length); String splitLocation = splitLocations[0];