Skip to content

Commit 9da3bd2

Browse files
committed
Update chart doc
Signed-off-by: Yuanchun Shen <yuanchu@amazon.com>
1 parent 7bef202 commit 9da3bd2

1 file changed

Lines changed: 17 additions & 14 deletions

File tree

docs/user/ppl/cmd/chart.rst

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -32,24 +32,26 @@ Syntax
3232

3333
* **limit**: optional. Specifies the number of distinct values to display when using column split.
3434

35-
* Default: 10
36-
* Syntax: ``limit=(top|bottom) <number>`` or ``limit=<number>`` (defaults to top)
37-
* When there are more distinct column split values than the limit, the additional values are grouped into an "OTHER" category if ``useother`` is not set to false.
38-
* Set to 0 to show all distinct values without any limit.
35+
* Default: top10
36+
* Syntax: ``limit=(top|bottom)<number>`` or ``limit=<number>`` (defaults to top)
37+
* When ``limit=K`` is set, the top or bottom K distinct column split values are retained; the additional values are grouped into an "OTHER" category if ``useother`` is not set to false.
38+
* Set limit to 0 to show all distinct values without any limit.
39+
* Use ``limit=topK`` or ``limit=bottomK`` to specify whether to retain the top or bottom K column categories. The ranking is based on the aggregated values for each distinct column-split value. For example, ``chart limit=top3 count() by a b`` retains the 3 most common b categories; ``chart limit=top5 min(value) by a b`` selects the 5 b categories that contains smallest aggregated values. If not specified, top is used by default.
3940
* Only applies when column split presents (by 2 fields or over...by... coexists).
4041

41-
* **useother**: optional. Controls whether to create an "OTHER" category for distinct column values beyond the limit.
42+
* **useother**: optional. Controls whether to create an "OTHER" category for distinct column-split values beyond the limit.
4243

4344
* Default: true
44-
* When set to false, only the top/bottom N distinct values (based on limit) are shown without an "OTHER" category.
45+
* When set to false, only the top/bottom N distinct column-split values (based on limit) are shown without an "OTHER" category.
4546
* When set to true, distinct values beyond the limit are grouped into an "OTHER" category.
46-
* Only applies when using column split and when there are more distinct column values than the limit.
47+
* Only applies when using column split and when there are more distinct column-split values than the limit.
4748

48-
* **usenull**: optional. Controls whether to include null values as a separate category.
49+
* **usenull**: optional. Controls whether to group events without a column split (i.e. whose column split is null) into a separate "NULL" category.
4950

5051
* Default: true
51-
* When set to false, events with null values in the split-by field are excluded from results.
52-
* When set to true, null values appear as a separate category.
52+
* When ``usenull=false``, events with a null column split are excluded from results.
53+
* When ``usenull=true``, events with a null column split are grouped into a separate "NULL" category.
54+
* ``usenull`` only applies to column split. Null values in the row split are handled in the same way as normal aggregations.
5355

5456
* **nullstr**: optional. Specifies the category name for rows that do not contain the column split value.
5557

@@ -80,7 +82,8 @@ Syntax
8082
Notes
8183
=====
8284

83-
* The column split field in the result will become strings so that they are compatible with ``nullstr`` and ``otherstr`` and can be used as column names once pivoted.
85+
* The fields generated by column splitting are converted to strings so that they are compatible with ``nullstr`` and ``otherstr`` and can be used as column names once pivoted.
86+
* The aggregation metric appears as the last column in the result. Result columns are ordered as: [row-split] [column-split] [aggregation-metrics]
8487

8588
Examples
8689
========
@@ -119,7 +122,7 @@ PPL query::
119122
Example 3: Using over and by for multiple field grouping
120123
--------------------------------------------------------
121124

122-
This example shows average balance grouped by both gender and age fields.
125+
This example shows average balance grouped by both gender and age fields. Note that the age column in the result is converted to string type.
123126

124127
PPL query::
125128

@@ -137,7 +140,7 @@ PPL query::
137140
Example 4: Using basic limit functionality
138141
------------------------------------------
139142

140-
This example limits the results to show only the top 1 age group.
143+
This example limits the results to show only the top 1 age group. Note that the age column in the result is converted to string type.
141144

142145
PPL query::
143146

@@ -158,7 +161,7 @@ This example shows using limit with useother and custom otherstr parameters.
158161

159162
PPL query::
160163

161-
os> source=accounts | chart limit=top 1 useother=true otherstr='minor_gender' count() over state by gender
164+
os> source=accounts | chart limit=top1 useother=true otherstr='minor_gender' count() over state by gender
162165
fetched rows / total rows = 4/4
163166
+-------+--------------+---------+
164167
| state | gender | count() |

0 commit comments

Comments
 (0)