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

JDBC table metadata should include fields declared in the schema (not dynamic) even if they are empty in the index

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • None
    • 9.0, 8.10
    • Parallel SQL

    Description

      Let's say I have field stringx declared in my schema but is empty (no docs in the index yet).

      Currently, the SolrSchema uses Luke to generate the table metadata and since stringx is empty, it's not included in the table metadata.

      select id, stringx from collection
      

      will fail with:

      Error while executing SQL "SELECT id, stringx FROM collection1": From line 1, column 12 to line 1, column 18: Column 'stringx' not found in any table
      	at org.apache.solr.client.solrj.io.stream.JDBCStream.open(JDBCStream.java:286)
      	at org.apache.solr.client.solrj.io.stream.ExceptionStream.open(ExceptionStream.java:52)
      

      Of course, if an application uses JDBC and describe table then they won't see stringx so no harm no foul. However, some apps / users may know that stringx is a field in the schema, leading to some mismatch in expectations and results.

      Attachments

        Activity

          People

            thelabdude Timothy Potter
            thelabdude Timothy Potter
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 1h 20m
                1h 20m