@Test(timeout=2000) public void testIntegerSplitter() throws Exception{ IntegerSplitter splitter = new IntegerSplitter(); ResultSet result = mock(ResultSet.class); List<InputSplit> splits = splitter.split(configuration, result, "column"); assertSplits(new String[] {".*column IS NULL"}, splits); when(result.getString(1)).thenReturn("result1"); when(result.getString(2)).thenReturn("result2"); when(result.getLong(1)).thenReturn(8L); when(result.getLong(2)).thenReturn(19L); splits = splitter.split(configuration, result, "column1"); assertSplits(new String[] {"column1 >= 8 column1 < 13", "column1 >= 13 column1 < 18", "column1 >= 18 column1 <= 19"}, splits); }
List<Long> splitPoints = split(numSplits, minVal, maxVal); List<InputSplit> splits = new ArrayList<InputSplit>();
List<Long> splitPoints = split(numSplits, minVal, maxVal); List<InputSplit> splits = new ArrayList<InputSplit>();
List<Long> splitPoints = split(numSplits, minVal, maxVal); List<InputSplit> splits = new ArrayList<InputSplit>();
public void testTooManySplits() throws SQLException { List<Long> splits = new IntegerSplitter().split(5, 3, 5); long [] expected = { 3, 4, 5 }; assertLongArrayEquals(expected, toLongArray(splits)); }
List<Long> splitPoints = split(numSplits, minVal, maxVal); List<InputSplit> splits = new ArrayList<InputSplit>();
List<Long> splitPoints = split(numSplits, minVal, maxVal); List<InputSplit> splits = new ArrayList<InputSplit>();
public void testOddSplits() throws SQLException { List<Long> splits = new IntegerSplitter().split(10, 0, 95); long [] expected = { 0, 9, 18, 27, 36, 45, 54, 63, 72, 81, 90, 95 }; assertLongArrayEquals(expected, toLongArray(splits)); }
public void testEvenSplits() throws SQLException { List<Long> splits = new IntegerSplitter().split(10, 0, 100); long [] expected = { 0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100 }; assertLongArrayEquals(expected, toLongArray(splits)); }
public void testSingletonSplit() throws SQLException { List<Long> splits = new IntegerSplitter().split(1, 5, 5); long [] expected = { 5, 5 }; assertLongArrayEquals(expected, toLongArray(splits)); }
public void testSingletonSplit2() throws SQLException { // Same test, but overly-high numSplits List<Long> splits = new IntegerSplitter().split(5, 5, 5); long [] expected = { 5, 5 }; assertLongArrayEquals(expected, toLongArray(splits)); }
public void testEvenSplits() throws SQLException { List<Long> splits = new IntegerSplitter().split(10, 0, 100); long [] expected = { 0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100 }; assertLongArrayEquals(expected, toLongArray(splits)); }
public void testSingletonSplit2() throws SQLException { // Same test, but overly-high numSplits List<Long> splits = new IntegerSplitter().split(5, 5, 5); long [] expected = { 5, 5 }; assertLongArrayEquals(expected, toLongArray(splits)); }
public void testTooManySplits() throws SQLException { List<Long> splits = new IntegerSplitter().split(5, 3, 5); long [] expected = { 3, 4, 5 }; assertLongArrayEquals(expected, toLongArray(splits)); }
public void testOddSplits() throws SQLException { List<Long> splits = new IntegerSplitter().split(10, 0, 95); long [] expected = { 0, 9, 18, 27, 36, 45, 54, 63, 72, 81, 90, 95 }; assertLongArrayEquals(expected, toLongArray(splits)); }
public void testSingletonSplit() throws SQLException { List<Long> splits = new IntegerSplitter().split(1, 5, 5); long [] expected = { 5, 5 }; assertLongArrayEquals(expected, toLongArray(splits)); }