Uploaded image for project: 'Calcite'
  1. Calcite
  2. CALCITE-1722

Druid adapter uses un-scaled value of DECIMAL literals

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.12.0
    • 1.13.0
    • None
    • None

    Description

      We have 2 issue here:
      1 Major, it is the lose of precision when converting filters with double values eg

       value < 1.455 

      For instance this is an example of wrong plan due to this bug.

       
       explain select d_year from ssb_druid where cast(d_year as double) < 1.2221;
      OK
      Plan optimized by CBO.
      
      Stage-0
        Fetch Operator
          limit:-1
          Select Operator [SEL_1]
            Output:["_col0"]
            TableScan [TS_0]
              Output:["d_year"],properties:{"druid.query.json":"{\"queryType\":\"select\",\"dataSource\":\"ssb_druid\",\"descending\":false,\"intervals\":[\"1900-01-01T00:00:00.000/3000-01-01T00:00:00.000\"],\"filter\":{\"type\":\"bound\",\"dimension\":\"d_year\",\"upper\":\"12221\",\"upperStrict\":true,\"alphaNumeric\":true},\"dimensions\":[\"d_year\"],\"metrics\":[],\"granularity\":\"all\",\"pagingSpec\":{\"threshold\":16384,\"fromNext\":true},\"context\":{\"druid.query.fetch\":false}}","druid.query.type":"select"}
      

      The second issue (Minor) is to use

      ordering

      instead of Alphanumeric, this is needed when comparing floats/doubles.

      Attachments

        Issue Links

          Activity

            People

              bslim Slim Bouguerra
              bslim Slim Bouguerra
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: