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

Solr SQL metrics for field with custom field type defaults to String instead of using the correct numeric type

    XMLWordPrintableJSON

Details

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

    Description

      I have a simple "stats" query (from SolrTable) that requests the min / max of an integer field, but that field is declared in the schema using a custom field type, such as:

        <fieldType name="integer" class="solr.TrieIntField" .../>
      
        <field name="myIntField" type="integer"  .../>
      

      The switch at https://github.com/apache/solr/blob/main/solr/core/src/java/org/apache/solr/handler/sql/SolrSchema.java#L144 causes the "type" for this field to be String which results in some weird output for this query:

      SELECT min(myIntField), max(myIntField) from table
      

      Results:

      {
        "result-set":{
          "docs":[{
              "EXPR$0":"2.0210507E7",
              "EXPR$1":"2.0210605E7"}
            ,{
              "EOF":true,
              "RESPONSE_TIME":8846}]}}
      

      Since we're querying /luke already to get schema info, we might as well use the field type info vs. defaulting to String

      Attachments

        Activity

          People

            thelabdude Timothy Potter
            thelabdude Timothy Potter
            Votes:
            0 Vote for this issue
            Watchers:
            3 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 40m
                1h 40m