From 86fb65b0b11d263ec6bb313e462a7b549af94ce8 Mon Sep 17 00:00:00 2001 From: Scott Anderson Date: Mon, 22 Jun 2020 14:01:08 -0600 Subject: [PATCH 1/2] added warning to group fn about sort order, closes #1129 --- .../flux/stdlib/built-in/transformations/group.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/content/v2.0/reference/flux/stdlib/built-in/transformations/group.md b/content/v2.0/reference/flux/stdlib/built-in/transformations/group.md index 77fc61f9c..0af36fcff 100644 --- a/content/v2.0/reference/flux/stdlib/built-in/transformations/group.md +++ b/content/v2.0/reference/flux/stdlib/built-in/transformations/group.md @@ -32,6 +32,13 @@ group(columns: ["_time"], mode:"except") group() ``` +{{% warn %}} +#### Group does not guarantee sort order +`group()` does not guarantee the sort order of output records. +To ensure data is sorted correctly, use [`sort()`](/v2.0/reference/flux/stdlib/built-in/transformations/sort/) +after `group()`. +{{% /warn %}} + ## Parameters ### columns From 84daa2ec0b3e2cf83bf8e806f0a177cb47ed9368 Mon Sep 17 00:00:00 2001 From: Scott Anderson Date: Mon, 22 Jun 2020 14:07:31 -0600 Subject: [PATCH 2/2] add example to group sort warning --- .../reference/flux/stdlib/built-in/transformations/group.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/content/v2.0/reference/flux/stdlib/built-in/transformations/group.md b/content/v2.0/reference/flux/stdlib/built-in/transformations/group.md index 0af36fcff..abb897cad 100644 --- a/content/v2.0/reference/flux/stdlib/built-in/transformations/group.md +++ b/content/v2.0/reference/flux/stdlib/built-in/transformations/group.md @@ -37,6 +37,12 @@ group() `group()` does not guarantee the sort order of output records. To ensure data is sorted correctly, use [`sort()`](/v2.0/reference/flux/stdlib/built-in/transformations/sort/) after `group()`. + +```js +data + |> group() + |> sort(columns: ["_time"]) +``` {{% /warn %}} ## Parameters