druid/extensions-core
Magnus Henoch 67f45fa7bf
Fix histograms for sketches where min and max are equal (#15381)
There is a problem with Quantiles sketches and KLL Quantiles sketches.
Queries using the histogram post-aggregator fail if:

- the sketch contains at least one value, and
- the values in the sketch are all equal, and
- the splitPoints argument is not passed to the post-aggregator, and
- the numBins argument is greater than 2 (or not specified, which
  leads to the default of 10 being used)

In that case, the query fails and returns this error:

    {
      "error": "Unknown exception",
      "errorClass": "org.apache.datasketches.common.SketchesArgumentException",
      "host": null,
      "errorCode": "legacyQueryException",
      "persona": "OPERATOR",
      "category": "RUNTIME_FAILURE",
      "errorMessage": "Values must be unique, monotonically increasing and not NaN.",
      "context": {
        "host": null,
        "errorClass": "org.apache.datasketches.common.SketchesArgumentException",
        "legacyErrorCode": "Unknown exception"
      }
    }

This behaviour is undesirable, since the caller doesn't necessarily
know in advance whether the sketch has values that are diverse
enough. With this change, the post-aggregators return [N, 0, 0...]
instead of crashing, where N is the number of values in the sketch,
and the length of the list is equal to numBins. That is what they
already returned for numBins = 2.

Here is an example of a query that would fail:

    {"queryType":"timeseries",
     "dataSource": {
       "type": "inline",
       "columnNames": ["foo", "bar"],
       "rows": [
          ["abc", 42.0],
          ["def", 42.0]
       ]
     },
     "intervals":["0000/3000"],
     "granularity":"all",
     "aggregations":[
       {"name":"the_sketch", "fieldName":"bar", "type":"quantilesDoublesSketch"}],
     "postAggregations":[
       {"name":"the_histogram",
        "type":"quantilesDoublesSketchToHistogram",
        "field":{"type":"fieldAccess","fieldName":"the_sketch"},
        "numBins": 3}]}

I believe this also fixes issue #10585.
2023-11-16 12:31:22 +05:30
..
avro-extensions Prepare master for Druid 29 (#15121) 2023-10-11 10:33:45 +05:30
azure-extensions Add system fields to input sources. (#15276) 2023-11-02 10:31:28 -07:00
datasketches Fix histograms for sketches where min and max are equal (#15381) 2023-11-16 12:31:22 +05:30
druid-aws-rds-extensions Prepare master for Druid 29 (#15121) 2023-10-11 10:33:45 +05:30
druid-basic-security Prepare master for Druid 29 (#15121) 2023-10-11 10:33:45 +05:30
druid-bloom-filter Relocating Table Schema Building: Shifting from Brokers to Coordinator for Improved Efficiency (#14985) 2023-11-04 19:33:25 +05:30
druid-catalog Prepare master for Druid 29 (#15121) 2023-10-11 10:33:45 +05:30
druid-kerberos Prepare master for Druid 29 (#15121) 2023-10-11 10:33:45 +05:30
druid-pac4j Prepare master for Druid 29 (#15121) 2023-10-11 10:33:45 +05:30
druid-ranger-security Prepare master for Druid 29 (#15121) 2023-10-11 10:33:45 +05:30
ec2-extensions Prepare master for Druid 29 (#15121) 2023-10-11 10:33:45 +05:30
google-extensions Add system fields to input sources. (#15276) 2023-11-02 10:31:28 -07:00
hdfs-storage Add system fields to input sources. (#15276) 2023-11-02 10:31:28 -07:00
histogram + Switching Comparison from String to JSON (#15364) 2023-11-14 08:07:19 -08:00
kafka-extraction-namespace Refactor lookups behavior while loading/dropping the containers (#14806) 2023-11-07 10:07:28 -08:00
kafka-indexing-service Prepare master for Druid 29 (#15121) 2023-10-11 10:33:45 +05:30
kinesis-indexing-service Prepare master for Druid 29 (#15121) 2023-10-11 10:33:45 +05:30
kubernetes-extensions Prepare master for Druid 29 (#15121) 2023-10-11 10:33:45 +05:30
lookups-cached-global Refactor lookups behavior while loading/dropping the containers (#14806) 2023-11-07 10:07:28 -08:00
lookups-cached-single Refactor lookups behavior while loading/dropping the containers (#14806) 2023-11-07 10:07:28 -08:00
multi-stage-query Fix cancellation bug in MSQ. (#15368) 2023-11-15 18:22:51 +05:30
mysql-metadata-storage Prepare master for Druid 29 (#15121) 2023-10-11 10:33:45 +05:30
orc-extensions Prepare master for Druid 29 (#15121) 2023-10-11 10:33:45 +05:30
parquet-extensions Fix json inputs for drill windowing tests (#15148) 2023-10-19 14:02:41 +05:30
postgresql-metadata-storage Prepare master for Druid 29 (#15121) 2023-10-11 10:33:45 +05:30
protobuf-extensions Fixed 2 Flaky Tests (#15376) 2023-11-15 18:40:09 +05:30
s3-extensions Fixed a flaky test in `S3DataSegmentPusherConfigTest#testSerialization` by changing string to key:value pair (#15207) 2023-11-15 09:05:55 -08:00
simple-client-sslcontext Prepare master for Druid 29 (#15121) 2023-10-11 10:33:45 +05:30
stats Relocating Table Schema Building: Shifting from Brokers to Coordinator for Improved Efficiency (#14985) 2023-11-04 19:33:25 +05:30
testing-tools Prepare master for Druid 29 (#15121) 2023-10-11 10:33:45 +05:30