mirror of https://github.com/apache/druid.git
Merge pull request #1461 from rasahner/doc_queryFixes
minor fixes to TimeseriesQuery and Aggregations
This commit is contained in:
commit
9104d08a6a
|
@ -92,7 +92,7 @@ All JavaScript functions must return numerical values.
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"type": "javascript",
|
"type": "javascript",
|
||||||
"name": "sum(log(x)/y) + 10",
|
"name": "sum(log(x)*y) + 10",
|
||||||
"fieldNames": ["x", "y"],
|
"fieldNames": ["x", "y"],
|
||||||
"fnAggregate" : "function(current, a, b) { return current + (Math.log(a) * b); }",
|
"fnAggregate" : "function(current, a, b) { return current + (Math.log(a) * b); }",
|
||||||
"fnCombine" : "function(partialA, partialB) { return partialA + partialB; }",
|
"fnCombine" : "function(partialA, partialB) { return partialA + partialB; }",
|
||||||
|
@ -137,11 +137,11 @@ SELECT COUNT(DISTINCT(value)) FROM (
|
||||||
|
|
||||||
#### Cardinality by row
|
#### Cardinality by row
|
||||||
|
|
||||||
When setting `byRow` to `true` it computes the cardinality by row, i.e. the cardinality of distinct dimension combinations
|
When setting `byRow` to `true` it computes the cardinality by row, i.e. the cardinality of distinct dimension combinations.
|
||||||
This is equivalent to something akin to
|
This is equivalent to something akin to
|
||||||
|
|
||||||
```sql
|
```sql
|
||||||
SELECT COUNT(*) FROM ( SELECT DIM1, DIM2, DIM3 FROM <datasource> GROUP BY DIM1, DIM2, DIM3
|
SELECT COUNT(*) FROM ( SELECT DIM1, DIM2, DIM3 FROM <datasource> GROUP BY DIM1, DIM2, DIM3 )
|
||||||
```
|
```
|
||||||
|
|
||||||
**Example**
|
**Example**
|
||||||
|
|
|
@ -56,7 +56,7 @@ There are 7 main parts to a timeseries query:
|
||||||
|postAggregations|See [Post Aggregations](../querying/post-aggregations.html)|no|
|
|postAggregations|See [Post Aggregations](../querying/post-aggregations.html)|no|
|
||||||
|context|See [Context](../querying/query-context.html)|no|
|
|context|See [Context](../querying/query-context.html)|no|
|
||||||
|
|
||||||
To pull it all together, the above query would return 2 data points, one for each day between 2012-01-01 and 2012-01-03, from the "sample\_datasource" table. Each data point would be the (long) sum of sample\_fieldName1, the (double) sum of sample\_fieldName2 and the (double) the result of sample\_fieldName1 divided by sample\_fieldName2 for the filter set. The output looks like this:
|
To pull it all together, the above query would return 2 data points, one for each day between 2012-01-01 and 2012-01-03, from the "sample\_datasource" table. Each data point would be the (long) sum of sample\_fieldName1, the (double) sum of sample\_fieldName2 and the (double) result of sample\_fieldName1 divided by sample\_fieldName2 for the filter set. The output looks like this:
|
||||||
|
|
||||||
```json
|
```json
|
||||||
[
|
[
|
||||||
|
|
Loading…
Reference in New Issue