SOLR-8799: Improve error message when tuple can't be read by SolrJ JDBC

This commit is contained in:
jbernste 2016-03-08 15:21:19 -05:00
parent 6eea1f94c4
commit 15bf038f29
2 changed files with 16 additions and 1 deletions

View File

@ -78,7 +78,7 @@ class ResultSetImpl implements ResultSet {
this.firstTuple = this.solrStream.read();
this.solrStream.pushBack(firstTuple);
} catch (IOException e) {
throw new SQLException("Couldn't read first tuple", e);
throw new SQLException(e);
}
this.resultSetMetaData = new ResultSetMetaDataImpl(this);

View File

@ -396,6 +396,21 @@ public class JdbcTest extends AbstractFullDistribZkTestBase {
}
}
//Test error propagation
props = new Properties();
props.put("aggregationMode", "facet");
try (Connection con = DriverManager.getConnection("jdbc:solr://" + zkHost + "?collection=collection1", props)) {
try (Statement stmt = con.createStatement()) {
try (ResultSet rs = stmt.executeQuery("select crap from collection1 group by a_s " +
"order by sum(a_f) desc")) {
} catch (Exception e) {
String errorMessage = e.getMessage();
assertTrue(errorMessage.contains("Group by queries must include atleast one aggregate function"));
}
}
}
testDriverMetadata();
}