Details
-
New Feature
-
Status: Closed
-
Major
-
Resolution: Fixed
-
6.0
-
None
Description
This ticket is to create a JDBC Driver (thin client) for the new SQL interface (SOLR-7560). As part of this ticket a driver will be added to the Solrj libary under the package: org.apache.solr.client.solrj.io.sql
Initial implementation will include basic Driver, Connection, Statement and ResultSet implementations.
Future releases can build on this implementation to support a wide range of JDBC clients and tools.
Syntax using parallel Map/Reduce for aggregations:
Properties props = new Properties(); props.put("aggregationMode", "map_reduce"); props.put("numWorkers", "10"); Connection con = DriverManager.getConnection("jdbc:solr://<zkhost:port>?collection=<collection>", props); Statement stmt = con.createStatement(); ResultSet rs = stmt.executeQuery("select a, sum(b) from tablex group by a having sum(b) > 100"); while(rs.next()) { String a = rs.getString("a"); double sumB = rs.getDouble("sum(b)"); }
Syntax using JSON facet API for aggregations:
Properties props = new Properties(); props.put("aggregationMode", "facet"); Connection con = DriverManager.getConnection("jdbc:solr://<zkhost:port>?collection=<collection>", props); Statement stmt = con.createStatement(); ResultSet rs = stmt.executeQuery("select a, sum(b) from tablex group by a having sum(b) > 100"); while(rs.next()) { String a = rs.getString("a"); double sumB = rs.getDouble("sum(b)"); }