Source:
protected InputStream openObjectStream(String object, File fileName) throws IOException { Preconditions.checkNotNull(sqlMetadataConnector, "SQL Metadata Connector not configured!"); try (FileOutputStream fos = new FileOutputStream(fileName)) { sqlMetadataConnector.retryWithHandle( (handle) -> { ResultIterator<Map<String, Object>> resultIterator = handle.createQuery( object ).map( (index, r, ctx) -> { Map<String, Object> resultRow = foldCase ? new CaseFoldedMap() : new HashMap<>(); ResultSetMetaData resultMetadata; try { resultMetadata = r.getMetaData(); } catch (SQLException e) { throw new ResultSetException("Unable to obtain metadata from result set", e, ctx); } try { for (int i = 1; i <= resultMetadata.getColumnCount(); i++) { String key = resultMetadata.getColumnName(i); String alias = resultMetadata.getColumnLabel(i); Object value = r.getObject(i); resultRow.put(alias != null ? alias : key, value); } } catch (SQLException e) { throw new ResultSetException("Unable to access specific metadata from " + "result set metadata", e, ctx); } return resultRow; } ).iterator(); while (resultIterator.hasNext()) { fos.write(objectMapper.writeValueAsBytes(resultIterator.next())); } return null; }, (exception) -> { final boolean isStatementException = exception instanceof StatementException || (exception instanceof CallbackFailedException && exception.getCause() instanceof StatementException); return sqlMetadataConnector.isTransientException(exception) && !(isStatementException); } ); } return new FileInputStream(fileName); }

Target:
protected InputStream openObjectStream(String object, File fileName) throws IOException { Preconditions.checkNotNull(sqlFirehoseDatabaseConnector, "SQL Metadata Connector not configured!"); try (FileOutputStream fos = new FileOutputStream(fileName)) { final JsonGenerator jg = objectMapper.getFactory().createGenerator(fos); sqlFirehoseDatabaseConnector.retryWithHandle( (handle) -> { ResultIterator<Map<String, Object>> resultIterator = handle.createQuery( object ).map( (index, r, ctx) -> { Map<String, Object> resultRow = foldCase ? new CaseFoldedMap() : new HashMap<>(); ResultSetMetaData resultMetadata; try { resultMetadata = r.getMetaData(); } catch (SQLException e) { throw new ResultSetException("Unable to obtain metadata from result set", e, ctx); } try { for (int i = 1; i <= resultMetadata.getColumnCount(); i++) { String key = resultMetadata.getColumnName(i); String alias = resultMetadata.getColumnLabel(i); Object value = r.getObject(i); resultRow.put(alias != null ? alias : key, value); } } catch (SQLException e) { throw new ResultSetException("Unable to access specific metadata from " + "result set metadata", e, ctx); } return resultRow; } ).iterator(); jg.writeStartArray(); while (resultIterator.hasNext()) { jg.writeObject(resultIterator.next()); } jg.writeEndArray(); jg.close(); return null; }, (exception) -> { final boolean isStatementException = exception instanceof StatementException || (exception instanceof CallbackFailedException && exception.getCause() instanceof StatementException); return sqlFirehoseDatabaseConnector.isTransientException(exception) && !(isStatementException); } ); } return new FileInputStream(fileName); }