mirror of
https://github.com/apache/druid.git
synced 2025-02-17 07:25:02 +00:00
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
|
```json
|
||||||
{
|
{
|
||||||
"type" : "filter",
|
"queryType": "groupBy",
|
||||||
"filter" : <any Druid query filter>
|
"dataSource": "sample_datasource",
|
||||||
|
...
|
||||||
|
"having":
|
||||||
|
{
|
||||||
|
"type" : "filter",
|
||||||
|
"filter" : <any Druid query filter>
|
||||||
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -26,12 +32,18 @@ For example, to use a selector filter:
|
|||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"type" : "filter",
|
"queryType": "groupBy",
|
||||||
"filter" : {
|
"dataSource": "sample_datasource",
|
||||||
"type": "selector",
|
...
|
||||||
"dimension" : "<dimension>",
|
"having":
|
||||||
"value" : "<dimension_value>"
|
{
|
||||||
}
|
"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
|
```json
|
||||||
{
|
{
|
||||||
"type": "greaterThan",
|
"queryType": "groupBy",
|
||||||
"aggregation": "myAggMetric",
|
"dataSource": "sample_datasource",
|
||||||
"value": 100
|
...
|
||||||
|
"having":
|
||||||
|
{
|
||||||
|
"type": "greaterThan",
|
||||||
|
"aggregation": "<aggregate_metric>",
|
||||||
|
"value": <numeric_value>
|
||||||
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -60,9 +78,15 @@ The grammar for an `equalTo` filter is as follows:
|
|||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"type": "equalTo",
|
"queryType": "groupBy",
|
||||||
"aggregation": "<aggregate_metric>",
|
"dataSource": "sample_datasource",
|
||||||
"value": <numeric_value>
|
...
|
||||||
|
"having":
|
||||||
|
{
|
||||||
|
"type": "equalTo",
|
||||||
|
"aggregation": "<aggregate_metric>",
|
||||||
|
"value": <numeric_value>
|
||||||
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -75,9 +99,15 @@ The grammar for a `greaterThan` filter is as follows:
|
|||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"type": "greaterThan",
|
"queryType": "groupBy",
|
||||||
"aggregation": "<aggregate_metric>",
|
"dataSource": "sample_datasource",
|
||||||
"value": <numeric_value>
|
...
|
||||||
|
"having":
|
||||||
|
{
|
||||||
|
"type": "greaterThan",
|
||||||
|
"aggregation": "<aggregate_metric>",
|
||||||
|
"value": <numeric_value>
|
||||||
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -90,9 +120,15 @@ The grammar for a `greaterThan` filter is as follows:
|
|||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"type": "lessThan",
|
"queryType": "groupBy",
|
||||||
"aggregation": "<aggregate_metric>",
|
"dataSource": "sample_datasource",
|
||||||
"value": <numeric_value>
|
...
|
||||||
|
"having":
|
||||||
|
{
|
||||||
|
"type": "lessThan",
|
||||||
|
"aggregation": "<aggregate_metric>",
|
||||||
|
"value": <numeric_value>
|
||||||
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -109,9 +145,15 @@ The grammar for a `dimSelector` filter is as follows:
|
|||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"type": "dimSelector",
|
"queryType": "groupBy",
|
||||||
"dimension": "<dimension>",
|
"dataSource": "sample_datasource",
|
||||||
"value": <dimension_value>
|
...
|
||||||
|
"having":
|
||||||
|
{
|
||||||
|
"type": "dimSelector",
|
||||||
|
"dimension": "<dimension>",
|
||||||
|
"value": <dimension_value>
|
||||||
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -124,35 +166,74 @@ The grammar for an AND filter is as follows:
|
|||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"type": "and",
|
"queryType": "groupBy",
|
||||||
"havingSpecs": [<having clause>, <having clause>, ...]
|
"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
|
#### OR
|
||||||
|
|
||||||
The grammar for an OR filter is as follows:
|
The grammar for an OR filter is as follows:
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"type": "or",
|
"queryType": "groupBy",
|
||||||
"havingSpecs": [<having clause>, <having clause>, ...]
|
"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
|
#### NOT
|
||||||
|
|
||||||
The grammar for a NOT filter is as follows:
|
The grammar for a NOT filter is as follows:
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"type": "not",
|
"queryType": "groupBy",
|
||||||
"havingSpec": <having clause>
|
"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…
x
Reference in New Issue
Block a user