### Question:
ResultSetRelation implements Relation { @Override public long getSize() throws InputException { try (ResultSet resultSet = executeQuery("SELECT COUNT(*) FROM (" + query + ") rel")) { if (resultSet.next()) { return resultSet.getLong(1); } throw new IllegalStateException("No count returned"); } catch (SQLException e) { throw new InputOpenException(e); } }  @Override Schema getSchema(); @Override long getSize(); @Override RelationalInput open(); @Override void hash(Hasher hasher);  }### Answer:
@Test public void testSize() throws SQLException, InputException { try (Statement statement = connection.createStatement()) { String query = "SELECT * FROM Person"; Relation relation = new ResultSetRelation(statement, query); assertThat(relation.getSize()).isEqualTo(3L); } try (Statement statement = connection.createStatement()) { String query = "SELECT * FROM PERSON WHERE name IS NULL"; Relation relation = new ResultSetRelation(statement, query); assertThat(relation.getSize()).isEqualTo(0L); } }