You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by "clintropolis (via GitHub)" <gi...@apache.org> on 2023/03/08 12:08:19 UTC

[GitHub] [druid] clintropolis commented on pull request #13897: use native nvl expression for SQL NVL and 2 argument COALESCE

clintropolis commented on PR #13897:
URL: https://github.com/apache/druid/pull/13897#issuecomment-1460060352

   marking WIP because this results in a performance regression at times (but not always)
   
   Ran the numbers before this PR and while queries 28 is same-ish, and 29 are significantly slower, 30 and 31 are a fair bit faster before this change.
   ```
   Benchmark              (query)  (rowsPerSegment)  (storageType)  (stringEncoding)  (vectorize)  Mode  Cnt     Score    Error  Units
   SqlBenchmark.querySql       28           5000000           mmap              none        false  avgt    5   141.133 ±  3.026  ms/op
   SqlBenchmark.querySql       28           5000000           mmap     front-coded-4        false  avgt    5   151.020 ±  6.796  ms/op
   SqlBenchmark.querySql       28           5000000           mmap    front-coded-16        false  avgt    5   142.013 ±  1.157  ms/op
   SqlBenchmark.querySql       29           5000000           mmap              none        false  avgt    5   877.378 ± 11.754  ms/op
   SqlBenchmark.querySql       29           5000000           mmap     front-coded-4        false  avgt    5  1263.192 ± 12.325  ms/op
   SqlBenchmark.querySql       29           5000000           mmap    front-coded-16        false  avgt    5  1483.152 ± 10.696  ms/op
   SqlBenchmark.querySql       30           5000000           mmap              none        false  avgt    5   100.516 ±  4.728  ms/op
   SqlBenchmark.querySql       30           5000000           mmap     front-coded-4        false  avgt    5   100.432 ±  2.805  ms/op
   SqlBenchmark.querySql       30           5000000           mmap    front-coded-16        false  avgt    5    91.875 ±  0.999  ms/op
   SqlBenchmark.querySql       31           5000000           mmap              none        false  avgt    5    22.473 ±  0.182  ms/op
   SqlBenchmark.querySql       31           5000000           mmap     front-coded-4        false  avgt    5    19.557 ±  0.258  ms/op
   SqlBenchmark.querySql       31           5000000           mmap    front-coded-16        false  avgt    5    18.795 ±  0.270  ms/op
   ```
   
   It turns out that for these queries some magic was happening for the case statements which resulted in native filters being used instead of expression filters, for example query 31 looks something like this in the native query
   
   ```
   {
     "type": "and",
     "fields": [
       {
         "type": "selector",
         "dimension": "dimSequential",
         "value": "1"
       },
       {
         "type": "selector",
         "dimension": "dimSequentialHalfNull",
         "value": null
       }
     ]
   },
   {
     "type": "and",
     "fields": [
       {
         "type": "selector",
         "dimension": "dimSequential",
         "value": "10"
       },
       {
         "type": "selector",
         "dimension": "dimSequentialHalfNull",
         "value": null
       }
     ]
   },
   {
     "type": "and",
     "fields": [
       {
         "type": "selector",
         "dimension": "dimSequential",
         "value": "100"
       },
       {
         "type": "selector",
         "dimension": "dimSequentialHalfNull",
         "value": null
       }
     ]
   },
   {
     "type": "in",
     "dimension": "dimSequentialHalfNull",
     "values": [
       "1",
       "10",
       "100"
     ]
   }
   ```
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org