IsmReader extends NativeReader<WindowedValue<IsmRecord<V>>> { public abstract IsmPrefixReaderIterator overKeyComponents(List<?> keyComponents) throws IOException;  static Closeable setSideInputReadContext(SideInputReadCounter readCounter); static SideInputReadCounter getCurrentSideInputCounter(); @Override abstract IsmPrefixReaderIterator iterator(); abstract IsmPrefixReaderIterator overKeyComponents(List<?> keyComponents); abstract IsmPrefixReaderIterator overKeyComponents(
      List<?> keyComponents, int shardId, RandomAccessData keyBytes); abstract boolean isInitialized(); abstract boolean isEmpty(); abstract ResourceId getResourceId(); abstract IsmRecordCoder<V> getCoder(); @Override String toString();  }
@Test public void testReadMissingKeys() throws Exception { File tmpFile = tmpFolder.newFile(); List<IsmRecord<byte[]>> data = new ArrayList<>(); data.add(IsmRecord.<byte[]>of(ImmutableList.of(EMPTY, new byte[] {0x04}), EMPTY)); data.add(IsmRecord.<byte[]>of(ImmutableList.of(EMPTY, new byte[] {0x08}), EMPTY)); writeElementsToFile(data, tmpFile); IsmReader<byte[]> reader = new IsmReaderImpl<byte[]>( FileSystems.matchSingleFileSpec(tmpFile.getAbsolutePath()).resourceId(), CODER, cache); assertFalse(reader.overKeyComponents(ImmutableList.of(EMPTY, new byte[] {0x02})).start()); assertFalse(reader.overKeyComponents(ImmutableList.of(EMPTY, new byte[] {0x06})).start()); assertFalse(reader.overKeyComponents(ImmutableList.of(EMPTY, new byte[] {0x10})).start()); }
@Test public void testReadMissingKeysBypassingBloomFilter() throws Exception { File tmpFile = tmpFolder.newFile(); List<IsmRecord<byte[]>> data = new ArrayList<>(); data.add(IsmRecord.<byte[]>of(ImmutableList.of(EMPTY, new byte[] {0x04}), EMPTY)); data.add(IsmRecord.<byte[]>of(ImmutableList.of(EMPTY, new byte[] {0x08}), EMPTY)); writeElementsToFile(data, tmpFile); IsmReader<byte[]> reader = new IsmReaderImpl<byte[]>( FileSystems.matchSingleFileSpec(tmpFile.getAbsolutePath()).resourceId(), CODER, cache) { @Override boolean bloomFilterMightContain(RandomAccessData keyBytes) { return true; } }; assertFalse(reader.overKeyComponents(ImmutableList.of(EMPTY, new byte[] {0x02})).start()); assertFalse(reader.overKeyComponents(ImmutableList.of(EMPTY, new byte[] {0x06})).start()); assertFalse(reader.overKeyComponents(ImmutableList.of(EMPTY, new byte[] {0x10})).start()); }