Source:
protected void pollRecords(PreparedStatement ps) { ResultSet rs = null; List<Object> metaList = new ArrayList<>(); if (isReplayed) { return; } try { if (ps.isClosed()) { LOG.debug("Returning due to closed ps for non-pollable partitions"); return; } } catch (SQLException e) { LOG.error("Prepared statement is closed", e); throw new RuntimeException(e); } try (PreparedStatement pStat = ps;) { pStat.setFetchSize(getFetchSize()); LOG.debug("sql query = {}", pStat); rs = pStat.executeQuery(); boolean hasNext = false; if (rs == null || rs.isClosed()) { return; } while ((hasNext = rs.next())) { Object key = null; StringBuilder resultTuple = new StringBuilder(); try { if (count < getBatchSize()) { key = rs.getObject(getKey()); for (String obj : emitColumns) { resultTuple.append(rs.getObject(obj) + ","); } metaList.add(resultTuple.substring(0, resultTuple.length() - 1)); count++; } else { emitQueue.add(metaList); metaList = new ArrayList<>(); key = rs.getObject(getKey()); for (String obj : emitColumns) { resultTuple.append(rs.getObject(obj) + ","); } metaList.add(resultTuple.substring(0, resultTuple.length() - 1)); count = 0; } } catch (NullPointerException npe) { LOG.error("Key not found" + npe); throw new RuntimeException(npe); } if (isPollable) { highestPolled = key.toString(); isPolled = true; } } if (!hasNext) { if ((isPollable && isPolled) || !isPollable) { emitQueue.add(metaList); metaList = new ArrayList<>(); count = 0; } if (!isPolled) { isPolled = true; } } LOG.debug("last creation time stamp = {}", lastCreationTsMillis); } catch (SQLException ex) { throw new RuntimeException(ex); } }

Target:
protected void pollRecords(PreparedStatement ps) { ResultSet rs = null; List<Object> metaList = new ArrayList<>(); if (isReplayed) { return; } try { if (ps.isClosed()) { LOG.debug("Returning due to closed ps for non-pollable partitions"); return; } } catch (SQLException e) { LOG.error("Prepared statement is closed", e); throw new RuntimeException(e); } try (PreparedStatement pStat = ps;) { pStat.setFetchSize(getFetchSize()); LOG.debug("sql query = {}", pStat); rs = pStat.executeQuery(); boolean hasNext = false; if (rs == null || rs.isClosed()) { return; } while ((hasNext = rs.next())) { Object key = null; StringBuilder resultTuple = new StringBuilder(); try { if (count < getBatchSize()) { key = rs.getObject(getKey()); for (String obj : emitColumns) { resultTuple.append(rs.getObject(obj) + ","); } metaList.add(resultTuple.substring(0, resultTuple.length() - 1)); count++; } else { emitQueue.add(metaList); metaList = new ArrayList<>(); key = rs.getObject(getKey()); for (String obj : emitColumns) { resultTuple.append(rs.getObject(obj) + ","); } metaList.add(resultTuple.substring(0, resultTuple.length() - 1)); count = 0; } } catch (NullPointerException npe) { LOG.error("Key not found" + npe); throw new RuntimeException(npe); } if (isPollable) { highestPolled = key.toString(); isPolled = true; } } if (!hasNext) { if ((isPollable && isPolled) || !isPollable) { emitQueue.offer(metaList); metaList = new ArrayList<>(); count = 0; } if (!isPolled) { isPolled = true; } } LOG.debug("last creation time stamp = {}", lastCreationTsMillis); } catch (SQLException ex) { throw new RuntimeException(ex); } }