Uploaded image for project: 'Solr'
  1. Solr
  2. SOLR-7986

JDBC Driver for SQL Interface

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 6.0
    • 6.0
    • clients - java
    • 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)");
      }
      

      Attachments

        1. SOLR-7986.patch
          100 kB
          Joel Bernstein
        2. SOLR-7986.patch
          95 kB
          Joel Bernstein
        3. SOLR-7986.patch
          94 kB
          Joel Bernstein
        4. SOLR-7986.patch
          84 kB
          Joel Bernstein
        5. SOLR-7986.patch
          41 kB
          Joel Bernstein
        6. SOLR-7986.patch
          44 kB
          Joel Bernstein
        7. SOLR-7986.patch
          44 kB
          Joel Bernstein
        8. SOLR-7986.patch
          41 kB
          Joel Bernstein
        9. SOLR-7986.patch
          37 kB
          Joel Bernstein
        10. SOLR-7986-SPI.patch
          2 kB
          Uwe Schindler

        Issue Links

          Activity

            People

              Unassigned Unassigned
              jbernste Joel Bernstein
              Votes:
              1 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: