Skip to content

I would like to have a finalizeFieldAccess post aggregator #2433

@vogievetsky

Description

@vogievetsky

99% of the post aggregators that I deal with are simple mathematical expressions (* / + -).
It is very bothersome to be meticulously keeping track of the aggregates that I am using to know weather they should be accessed with a filedAccess or a hyperUniqueCardinality or whatever.

I would love to have a finalizeFieldAccess post aggregator that I can just use everywhere to get a number out of a sketch.

For a simple aggregator like sum using finalizeFieldAccess would be equivalent to fieldAccess

For a sketch it would do some reasonable default (the same default as what happens when the query is returned)

I believe this will make the Druid API much friendlier to use manually and programmatically

{
  "dataSource": "diamonds",
  "queryType": "timeseries",
  "granularity": "all",
  "intervals": [
    "2015-03-12/2015-03-19"
  ],
  "aggregations": [
    {
      "byRow": true,
      "fieldNames": [
        "color"
      ],
      "name": "NumColors",
      "type": "cardinality"
    },
    {
      "fieldName": "price",
      "name": "Price",
      "type": "sum"
    }
  ],
  "postAggregations": [
    {
      "fields": [
        {
          "fieldName": "Price",
          "type": "fieldAccess"
        },
        {
          "fieldName": "NumColors",
          "type": "hyperUniqueCardinality"
        }
      ],
      "fn": "/",
      "name": "PricePerColor",
      "type": "arithmetic"
    }
  ]
}

would become:

{
  "dataSource": "diamonds",
  "queryType": "timeseries",
  "granularity": "all",
  "intervals": [
    "2015-03-12/2015-03-19"
  ],
  "aggregations": [
    {
      "byRow": true,
      "fieldNames": [
        "color"
      ],
      "name": "NumColors",
      "type": "cardinality"
    },
    {
      "fieldName": "price",
      "name": "Price",
      "type": "sum"
    }
  ],
  "postAggregations": [
    {
      "fields": [
        {
          "fieldName": "Price",
          "type": "finalizeFieldAccess"
        },
        {
          "fieldName": "NumColors",
          "type": "finalizeFieldAccess"
        }
      ],
      "fn": "/",
      "name": "PricePerColor",
      "type": "arithmetic"
    }
  ]
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions