@Override public float getProgress() throws IOException { if (this.getIOContext().isBinarySearching()) { return 0; } else { return recordReader.getProgress(); } }
@Override public float getProgress() throws IOException { if (this.getIOContext().isBinarySearching()) { return 0; } else { return recordReader.getProgress(); } }
@Override public float getProgress() throws IOException { // The calculation is strongly dependent on the assumption that all splits // came from the same file return Math.min(1.0f, ((recordReader == null || this.getIOContext().isBinarySearching()) ? progress : recordReader.getPos()) / (float) (split.getLength())); }
stopComparisons.add(Comparison.EQUAL); stopComparisons.add(Comparison.GREATER); if (this.getIOContext().isBinarySearching()) { beginLinearSearch(); if (this.getIOContext().isBinarySearching()) { beginLinearSearch(); if (this.getIOContext().isBinarySearching()) { beginLinearSearch();
@Override public float getProgress() throws IOException { // The calculation is strongly dependent on the assumption that all splits // came from the same file return Math.min(1.0f, ((recordReader == null || this.getIOContext().isBinarySearching()) ? progress : recordReader.getPos()) / (float) (split.getLength())); }
stopComparisons.add(Comparison.EQUAL); stopComparisons.add(Comparison.GREATER); if (this.getIOContext().isBinarySearching()) { beginLinearSearch(); if (this.getIOContext().isBinarySearching()) { beginLinearSearch(); if (this.getIOContext().isBinarySearching()) { beginLinearSearch();
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()); }
if (ioContext.isBinarySearching()) { consecutiveSearches++; if (ioContext.isBinarySearching()) { return;
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)); }
if (ioContext.isBinarySearching()) { consecutiveSearches++; if (ioContext.isBinarySearching()) { return;
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()); }
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)); }
if (this.getIOContext().isBinarySearching()) {
if (this.getIOContext().isBinarySearching()) {
@Override public float getProgress() throws IOException { if (this.getIOContext().isBinarySearching()) { return 0; } else { return recordReader.getProgress(); } }
@Override public float getProgress() throws IOException { // The calculation is strongly dependent on the assumption that all splits // came from the same file return Math.min(1.0f, ((recordReader == null || this.getIOContext().isBinarySearching()) ? progress : recordReader.getPos()) / (float) (split.getLength())); }