mirror of https://github.com/apache/druid.git
Provide examples to havingSpec filters (#5774)
* expand examples * expand examples for filtered havingSpecs * expand other having examples * remove blank code block * add better AND/OR/NOT examples * fix indentation
This commit is contained in:
parent
15864434be
commit
c73e3ea4f5
|
@ -16,8 +16,14 @@ The grammar for a query filter HavingSpec is:
|
|||
|
||||
```json
|
||||
{
|
||||
"type" : "filter",
|
||||
"filter" : <any Druid query filter>
|
||||
"queryType": "groupBy",
|
||||
"dataSource": "sample_datasource",
|
||||
...
|
||||
"having":
|
||||
{
|
||||
"type" : "filter",
|
||||
"filter" : <any Druid query filter>
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
|
@ -26,12 +32,18 @@ For example, to use a selector filter:
|
|||
|
||||
```json
|
||||
{
|
||||
"type" : "filter",
|
||||
"filter" : {
|
||||
"type": "selector",
|
||||
"dimension" : "<dimension>",
|
||||
"value" : "<dimension_value>"
|
||||
}
|
||||
"queryType": "groupBy",
|
||||
"dataSource": "sample_datasource",
|
||||
...
|
||||
"having":
|
||||
{
|
||||
"type" : "filter",
|
||||
"filter" : {
|
||||
"type": "selector",
|
||||
"dimension" : "<dimension>",
|
||||
"value" : "<dimension_value>"
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
|
@ -47,9 +59,15 @@ Here's an example of a having-clause numeric filter:
|
|||
|
||||
```json
|
||||
{
|
||||
"type": "greaterThan",
|
||||
"aggregation": "myAggMetric",
|
||||
"value": 100
|
||||
"queryType": "groupBy",
|
||||
"dataSource": "sample_datasource",
|
||||
...
|
||||
"having":
|
||||
{
|
||||
"type": "greaterThan",
|
||||
"aggregation": "<aggregate_metric>",
|
||||
"value": <numeric_value>
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
|
@ -60,9 +78,15 @@ The grammar for an `equalTo` filter is as follows:
|
|||
|
||||
```json
|
||||
{
|
||||
"type": "equalTo",
|
||||
"aggregation": "<aggregate_metric>",
|
||||
"value": <numeric_value>
|
||||
"queryType": "groupBy",
|
||||
"dataSource": "sample_datasource",
|
||||
...
|
||||
"having":
|
||||
{
|
||||
"type": "equalTo",
|
||||
"aggregation": "<aggregate_metric>",
|
||||
"value": <numeric_value>
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
|
@ -75,9 +99,15 @@ The grammar for a `greaterThan` filter is as follows:
|
|||
|
||||
```json
|
||||
{
|
||||
"type": "greaterThan",
|
||||
"aggregation": "<aggregate_metric>",
|
||||
"value": <numeric_value>
|
||||
"queryType": "groupBy",
|
||||
"dataSource": "sample_datasource",
|
||||
...
|
||||
"having":
|
||||
{
|
||||
"type": "greaterThan",
|
||||
"aggregation": "<aggregate_metric>",
|
||||
"value": <numeric_value>
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
|
@ -90,9 +120,15 @@ The grammar for a `greaterThan` filter is as follows:
|
|||
|
||||
```json
|
||||
{
|
||||
"type": "lessThan",
|
||||
"aggregation": "<aggregate_metric>",
|
||||
"value": <numeric_value>
|
||||
"queryType": "groupBy",
|
||||
"dataSource": "sample_datasource",
|
||||
...
|
||||
"having":
|
||||
{
|
||||
"type": "lessThan",
|
||||
"aggregation": "<aggregate_metric>",
|
||||
"value": <numeric_value>
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
|
@ -109,9 +145,15 @@ The grammar for a `dimSelector` filter is as follows:
|
|||
|
||||
```json
|
||||
{
|
||||
"type": "dimSelector",
|
||||
"dimension": "<dimension>",
|
||||
"value": <dimension_value>
|
||||
"queryType": "groupBy",
|
||||
"dataSource": "sample_datasource",
|
||||
...
|
||||
"having":
|
||||
{
|
||||
"type": "dimSelector",
|
||||
"dimension": "<dimension>",
|
||||
"value": <dimension_value>
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
|
@ -124,35 +166,74 @@ The grammar for an AND filter is as follows:
|
|||
|
||||
```json
|
||||
{
|
||||
"type": "and",
|
||||
"havingSpecs": [<having clause>, <having clause>, ...]
|
||||
"queryType": "groupBy",
|
||||
"dataSource": "sample_datasource",
|
||||
...
|
||||
"having":
|
||||
{
|
||||
"type": "and",
|
||||
"havingSpecs": [
|
||||
{
|
||||
"type": "greaterThan",
|
||||
"aggregation": "<aggregate_metric>",
|
||||
"value": <numeric_value>
|
||||
},
|
||||
{
|
||||
"type": "lessThan",
|
||||
"aggregation": "<aggregate_metric>",
|
||||
"value": <numeric_value>
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
The having clauses in `havingSpecs` can be any other having clause defined on this page.
|
||||
|
||||
#### OR
|
||||
|
||||
The grammar for an OR filter is as follows:
|
||||
|
||||
```json
|
||||
{
|
||||
"type": "or",
|
||||
"havingSpecs": [<having clause>, <having clause>, ...]
|
||||
"queryType": "groupBy",
|
||||
"dataSource": "sample_datasource",
|
||||
...
|
||||
"having":
|
||||
{
|
||||
"type": "or",
|
||||
"havingSpecs": [
|
||||
{
|
||||
"type": "greaterThan",
|
||||
"aggregation": "<aggregate_metric>",
|
||||
"value": <numeric_value>
|
||||
},
|
||||
{
|
||||
"type": "equalTo",
|
||||
"aggregation": "<aggregate_metric>",
|
||||
"value": <numeric_value>
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
The having clauses in `havingSpecs` can be any other having clause defined on this page.
|
||||
|
||||
#### NOT
|
||||
|
||||
The grammar for a NOT filter is as follows:
|
||||
|
||||
```json
|
||||
{
|
||||
"type": "not",
|
||||
"havingSpec": <having clause>
|
||||
"queryType": "groupBy",
|
||||
"dataSource": "sample_datasource",
|
||||
...
|
||||
"having":
|
||||
{
|
||||
"type": "not",
|
||||
"havingSpec":
|
||||
{
|
||||
"type": "equalTo",
|
||||
"aggregation": "<aggregate_metric>",
|
||||
"value": <numeric_value>
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
The having clause specified at `havingSpec` can be any other having clause defined on this page.
|
||||
|
|
Loading…
Reference in New Issue