public void testLessThanOpClass() throws Exception { init(); ioContext.setGenericUDFClassName(GenericUDFOPLessThan.class.getName()); Assert.assertTrue(executeDoNext(hbsReader)); Assert.assertFalse(ioContext.isBinarySearching()); ioContext.setComparison(-1); Assert.assertTrue(executeDoNext(hbsReader)); ioContext.setComparison(0); Assert.assertFalse(executeDoNext(hbsReader)); ioContext.setComparison(1); Assert.assertFalse(executeDoNext(hbsReader)); }
public void testLessThanOrEqualOpClass() throws Exception { init(); ioContext.setGenericUDFClassName(GenericUDFOPEqualOrLessThan.class.getName()); Assert.assertTrue(executeDoNext(hbsReader)); Assert.assertFalse(ioContext.isBinarySearching()); ioContext.setComparison(-1); Assert.assertTrue(executeDoNext(hbsReader)); ioContext.setComparison(0); Assert.assertTrue(executeDoNext(hbsReader)); ioContext.setComparison(1); Assert.assertFalse(executeDoNext(hbsReader)); }
public void testGreaterThanOrEqualOpClass() throws Exception { init(); ioContext.setGenericUDFClassName(GenericUDFOPEqualOrGreaterThan.class.getName()); Assert.assertTrue(ioContext.isBinarySearching()); Assert.assertTrue(executeDoNext(hbsReader)); ioContext.setBinarySearching(false); ioContext.setComparison(-1); Assert.assertTrue(executeDoNext(hbsReader)); ioContext.setComparison(0); Assert.assertTrue(executeDoNext(hbsReader)); ioContext.setComparison(1); Assert.assertTrue(executeDoNext(hbsReader)); }
public void testEqualOpClass() throws Exception { init(); ioContext.setGenericUDFClassName(GenericUDFOPEqual.class.getName()); Assert.assertTrue(ioContext.isBinarySearching()); Assert.assertTrue(executeDoNext(hbsReader)); ioContext.setBinarySearching(false); ioContext.setComparison(-1); Assert.assertTrue(executeDoNext(hbsReader)); ioContext.setComparison(0); Assert.assertTrue(executeDoNext(hbsReader)); ioContext.setComparison(1); Assert.assertFalse(executeDoNext(hbsReader)); }
public void testGreaterThanOpClass() throws Exception { init(); ioContext.setGenericUDFClassName(GenericUDFOPGreaterThan.class.getName()); Assert.assertTrue(ioContext.isBinarySearching()); Assert.assertTrue(executeDoNext(hbsReader)); ioContext.setBinarySearching(false); ioContext.setComparison(-1); Assert.assertTrue(executeDoNext(hbsReader)); ioContext.setComparison(0); Assert.assertTrue(executeDoNext(hbsReader)); ioContext.setComparison(1); Assert.assertTrue(executeDoNext(hbsReader)); }
public void testNonLinearGreaterThan() throws Exception { init(); Assert.assertTrue(executeDoNext(hbsReader)); verify(rcfReader).sync(50); ioContext.setComparison(1); when(rcfReader.getPos()).thenReturn(25L); // By setting the comparison to greater, the search should use the block [0, 50] Assert.assertTrue(executeDoNext(hbsReader)); verify(rcfReader).sync(25); }
public void testNonLinearLessThan() throws Exception { init(); Assert.assertTrue(executeDoNext(hbsReader)); verify(rcfReader).sync(50); ioContext.setComparison(-1); when(rcfReader.getPos()).thenReturn(75L); // By setting the comparison to less, the search should use the block [50, 100] Assert.assertTrue(executeDoNext(hbsReader)); verify(rcfReader).sync(75); }
public void testNonLinearEqualTo() throws Exception { init(); Assert.assertTrue(executeDoNext(hbsReader)); verify(rcfReader).sync(50); ioContext.setComparison(0); when(rcfReader.getPos()).thenReturn(25L); // By setting the comparison to equal, the search should use the block [0, 50] Assert.assertTrue(executeDoNext(hbsReader)); verify(rcfReader).sync(25); }
public void testHitSamePositionTwice() throws Exception { init(); Assert.assertTrue(executeDoNext(hbsReader)); verify(rcfReader).sync(50); ioContext.setComparison(1); // When getPos is called it should return the same value, signaling the end of the search, so // the search should continue linearly and it should sync to the beginning of the block [0, 50] Assert.assertTrue(executeDoNext(hbsReader)); InOrder inOrder = inOrder(rcfReader); inOrder.verify(rcfReader).sync(25); inOrder.verify(rcfReader).sync(0); Assert.assertFalse(ioContext.isBinarySearching()); }
public void testHitLastBlock() throws Exception { init(); Assert.assertTrue(executeDoNext(hbsReader)); verify(rcfReader).sync(50); ioContext.setComparison(-1); when(rcfReader.getPos()).thenReturn(100L); // When sync is called it will return 100, the value signaling the end of the file, this should // result in a call to sync to the beginning of the block it was searching [50, 100], and it // should continue normally Assert.assertTrue(executeDoNext(hbsReader)); InOrder inOrder = inOrder(rcfReader); inOrder.verify(rcfReader).sync(75); inOrder.verify(rcfReader).sync(50); Assert.assertFalse(ioContext.isBinarySearching()); }
public void testResetRange() throws Exception { init(); InOrder inOrder = inOrder(rcfReader); Assert.assertTrue(executeDoNext(hbsReader)); inOrder.verify(rcfReader).sync(50); ioContext.setComparison(-1); when(rcfReader.getPos()).thenReturn(75L); Assert.assertTrue(executeDoNext(hbsReader)); inOrder.verify(rcfReader).sync(75); ioContext.setEndBinarySearch(true); // This should make the search linear, sync to the beginning of the block being searched // [50, 100], set the comparison to be null, and the flag to reset the range should be unset Assert.assertTrue(executeDoNext(hbsReader)); inOrder.verify(rcfReader).sync(50); Assert.assertFalse(ioContext.isBinarySearching()); Assert.assertFalse(ioContext.shouldEndBinarySearch()); }
private void resetIOContext() { conf.set(Utilities.INPUT_NAME, "TestHiveBinarySearchRecordReader"); ioContext = IOContextMap.get(conf); ioContext.setUseSorted(false); ioContext.setBinarySearching(false); ioContext.setEndBinarySearch(false); ioContext.setComparison(null); ioContext.setGenericUDFClassName(null); }
return; } else { ioContext.setComparison(((ExprNodeGenericFuncEvaluator)conditionEvaluator).compare(row));
return; } else { ioContext.setComparison(((ExprNodeGenericFuncEvaluator)conditionEvaluator).compare(row));
return; } else { ioContext.setComparison(((ExprNodeGenericFuncEvaluator)conditionEvaluator).compare(row));