Skip to content

Commit 1c12e22

Browse files
Merge pull request #2537 from MicrosoftDocs/main638743544380849667sync_temp
For protected branch, push strategy should use PR and merge to target branch method to work around git push error
2 parents f7d1903 + df058d0 commit 1c12e22

32 files changed

+536
-268
lines changed

data-explorer/kusto/management/materialized-views/materialized-views-monitoring.md

Lines changed: 127 additions & 29 deletions
Large diffs are not rendered by default.

data-explorer/kusto/query/arg-max-aggregation-function.md

Lines changed: 32 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: arg_max() (aggregation function)
33
description: Learn how to use the arg_max() aggregation function to find a row in a table that maximizes the input expression.
44
ms.reviewer: alexans
55
ms.topic: reference
6-
ms.date: 11/11/2024
6+
ms.date: 01/15/2025
77
---
88
# arg_max() (aggregation function)
99

@@ -37,7 +37,9 @@ Returns a row in the table that maximizes the specified expression *ExprToMaximi
3737
3838
## Examples
3939

40-
Find the maximum latitude of a storm event in each state.
40+
### Find maximum latitude
41+
42+
The following example finds the maximum latitude of a storm event in each state.
4143

4244
:::moniker range="azure-data-explorer"
4345
> [!div class="nextstepaction"]
@@ -49,6 +51,8 @@ StormEvents
4951
| summarize arg_max(BeginLat, BeginLocation) by State
5052
```
5153

54+
**Output**
55+
5256
The results table displays only the first 10 rows.
5357

5458
| State | BeginLat | BeginLocation |
@@ -65,9 +69,11 @@ The results table displays only the first 10 rows.
6569
| TEXAS | 36.4607 | DARROUZETT |
6670
| ... | ... | ... |
6771

68-
Find the last time an event with a direct death happened in each state, showing all the columns.
72+
### Find last state fatal event
73+
74+
The following example finds the last time an event with a direct death happened in each state, showing all the columns.
6975

70-
The query first filters the events to only include those where there was at least one direct death. Then the query returns the entire row with the most recent StartTime.
76+
The query first filters the events to include only those events where there was at least one direct death. Then the query returns the entire row with the most recent `StartTime`.
7177

7278
:::moniker range="azure-data-explorer"
7379
> [!div class="nextstepaction"]
@@ -80,21 +86,25 @@ StormEvents
8086
| summarize arg_max(StartTime, *) by State
8187
```
8288

83-
The results table displays only the first 10 rows and first 3 columns.
89+
**Output**
90+
91+
The results table displays only the first 10 rows and first three columns.
8492

85-
| State | StartTime | EndTime | ... |
86-
| -------------- | -------------------- | -------------------- | --- |
87-
| GUAM | 2007-01-27T11:15:00Z | 2007-01-27T11:30:00Z | ... |
88-
| MASSACHUSETTS | 2007-02-03T22:00:00Z | 2007-02-04T10:00:00Z | ... |
93+
| State | StartTime | EndTime | ... |
94+
|--|--|--|--|
95+
| GUAM | 2007-01-27T11:15:00Z | 2007-01-27T11:30:00Z | ... |
96+
| MASSACHUSETTS | 2007-02-03T22:00:00Z | 2007-02-04T10:00:00Z | ... |
8997
| AMERICAN SAMOA | 2007-02-17T13:00:00Z | 2007-02-18T11:00:00Z | ... |
90-
| IDAHO | 2007-02-17T13:00:00Z | 2007-02-17T15:00:00Z | ... |
91-
| DELAWARE | 2007-02-25T13:00:00Z | 2007-02-26T01:00:00Z | ... |
92-
| WYOMING | 2007-03-10T17:00:00Z | 2007-03-10T17:00:00Z | ... |
93-
| NEW MEXICO | 2007-03-23T18:42:00Z | 2007-03-23T19:06:00Z | ... |
94-
| INDIANA | 2007-05-15T14:14:00Z | 2007-05-15T14:14:00Z | ... |
95-
| MONTANA | 2007-05-18T14:20:00Z | 2007-05-18T14:20:00Z | ... |
96-
| LAKE MICHIGAN | 2007-06-07T13:00:00Z | 2007-06-07T13:00:00Z | ... |
97-
|... | ... | ...| ... |
98+
| IDAHO | 2007-02-17T13:00:00Z | 2007-02-17T15:00:00Z | ... |
99+
| DELAWARE | 2007-02-25T13:00:00Z | 2007-02-26T01:00:00Z | ... |
100+
| WYOMING | 2007-03-10T17:00:00Z | 2007-03-10T17:00:00Z | ... |
101+
| NEW MEXICO | 2007-03-23T18:42:00Z | 2007-03-23T19:06:00Z | ... |
102+
| INDIANA | 2007-05-15T14:14:00Z | 2007-05-15T14:14:00Z | ... |
103+
| MONTANA | 2007-05-18T14:20:00Z | 2007-05-18T14:20:00Z | ... |
104+
| LAKE MICHIGAN | 2007-06-07T13:00:00Z | 2007-06-07T13:00:00Z | ... |
105+
| ... | ... | ... | ... |
106+
107+
### Handle nulls
98108

99109
The following example demonstrates null handling.
100110

@@ -125,15 +135,15 @@ datatable(Fruit: string, Color: string, Version: int) [
125135

126136
## Comparison to max()
127137

128-
The arg_max() function differs from the [max() function](max-aggregation-function.md). The arg_max() function allows you to return additional columns along with the maximum value, and [max()](max-aggregation-function.md) only returns the maximum value itself.
138+
The arg_max() function differs from the [max() function](max-aggregation-function.md). The arg_max() function allows you to return other columns along with the maximum value, and [max()](max-aggregation-function.md) only returns the maximum value itself.
129139

130140
### Examples
131141

132142
#### arg_max()
133143

134144
Find the last time an event with a direct death happened, showing all the columns in the table.
135145

136-
The query first filters the events to only include those where there was at least one direct death. Then the query returns the entire row with the most recent (maximum) StartTime.
146+
The query first filters the events to only include events where there was at least one direct death. Then the query returns the entire row with the most recent (maximum) StartTime.
137147

138148
:::moniker range="azure-data-explorer"
139149
> [!div class="nextstepaction"]
@@ -156,7 +166,7 @@ The results table returns all the columns for the row containing the highest val
156166

157167
Find the last time an event with a direct death happened.
158168

159-
The query filters events to only include those where there is at least one direct death, and then returns the maximum value for StartTime.
169+
The query filters events to only include events where there is at least one direct death, and then returns the maximum value for StartTime.
160170

161171
:::moniker range="azure-data-explorer"
162172
> [!div class="nextstepaction"]
@@ -177,7 +187,8 @@ The results table returns the maximum value of StartTime, without returning othe
177187

178188
## Related content
179189

190+
* [Aggregation function types at a glance](aggregation-functions.md)
191+
* [arg_min function](arg-min-aggregation-function.md)
180192
* [max function](max-aggregation-function.md)
181-
* [min function](min-aggregation-function.md)
182193
* [avg function](avg-aggregation-function.md)
183194
* [percentile function](percentiles-aggregation-function.md)

data-explorer/kusto/query/array-sort-asc-function.md

Lines changed: 33 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: array_sort_asc()
33
description: Learn how to use the array_sort_asc() function to sort arrays in ascending order.
44
ms.reviewer: slneimer
55
ms.topic: reference
6-
ms.date: 08/11/2024
6+
ms.date: 02/03/2025
77
---
88
# array_sort_asc()
99

@@ -32,14 +32,20 @@ Returns the same number of arrays as in the input, with the first array sorted i
3232

3333
`null` is returned for every array that differs in length from the first one.
3434

35-
If an array contains elements of different types, it's sorted in the following order:
35+
An array which contains elements of different types, is sorted in the following order:
3636

3737
* Numeric, `datetime`, and `timespan` elements
3838
* String elements
3939
* Guid elements
4040
* All other elements
4141

42-
## Example 1 - Sorting two arrays
42+
## Examples
43+
44+
The examples in this section show how to use the syntax to help you get started.
45+
46+
### Sort two arrays
47+
48+
The following example sorts the initial array, `array1`, in ascending order. It then sorts `array2` to match the new order of `array1`.
4349

4450
:::moniker range="azure-data-explorer"
4551
> [!div class="nextstepaction"]
@@ -59,17 +65,19 @@ print array_sort_asc(array1,array2)
5965
|[1,2,3,4,5]|["a","e","b","c","d"]|
6066

6167
> [!NOTE]
62-
> The output column names are generated automatically, based on the arguments to the function. To assign different names to the output columns, use the following syntax: `... | extend (out1, out2) = array_sort_asc(array1,array2)`
68+
> The output column names are generated automatically, based on the arguments to the function. To assign different names to the output columns, use the following syntax: `... | extend (out1, out2) = array_sort_asc(array1,array2)`.
69+
70+
### Sort substrings
6371

64-
## Example 2 - Sorting substrings
72+
The following example sorts a list of names in ascending order. It saves a list of names to a variable, `Names`, which is then splits into an array and sorted in ascending order. The query returns the names in ascending order.
6573

6674
:::moniker range="azure-data-explorer"
6775
> [!div class="nextstepaction"]
68-
> <a href="https://dataexplorer.azure.com/clusters/help/databases/Samples?query=H4sIAAAAAAAAA8tJLVHwS8xNLVawVVDyys/I0wlILM3RcU/NL0pP1QnKzEvPV7LmygGqCs4vKklNgaktLilKTiyJTywqSqzUAJPxxUAF8YnFyRrFBTmZJRpglToKSjpKmpoQypqroCgzr0ShKLW4NKcEaAiSkQD+ChdoiAAAAA==" target="_blank">Run the query</a>
76+
> <a href="https://dataexplorer.azure.com/clusters/help/databases/Samples?query=H4sIAAAAAAAAA8tJLVHwS8xNLVawVVDyys%2FI0wlILM3R8UrMS9XxTsxXsublygEqCc4vKklNgSksLilKTiyJTywqSqzUAJPxxUAF8YnFyRrFBTmZJRpglToKSjpKmpoQCmhQQVFmXolCUWpxaU4J0BQkMwFYffnyhgAAAA%3D%3D" target="_blank">Run the query</a>
6977
::: moniker-end
7078

7179
```kusto
72-
let Names = "John,Paul,George,Ringo";
80+
let Names = "John,Paul,Jane,Kao";
7381
let SortedNames = strcat_array(array_sort_asc(split(Names, ",")), ",");
7482
print result = SortedNames
7583
```
@@ -78,9 +86,11 @@ print result = SortedNames
7886

7987
|result|
8088
|---|
81-
|George,John,Paul,Ringo|
89+
|Jane,John,Kao,Paul|
8290

83-
## Example 3 - Combining summarize and array_sort_asc
91+
### Combine summarize and array_sort_asc
92+
93+
The following example uses the `summarize` operator and the `array_sort_asc` function to organize and sort commands by user in chronological order.
8494

8595
:::moniker range="azure-data-explorer"
8696
> [!div class="nextstepaction"]
@@ -111,46 +121,49 @@ datatable(command:string, command_time:datetime, user_id:string)
111121
|user2|[<br> "rm",<br> "pwd"<br>]|
112122

113123
> [!NOTE]
114-
> If your data may contain `null` values, use [make_list_with_nulls](make-list-with-nulls-aggregation-function.md) instead of [make_list](make-list-aggregation-function.md).
124+
> If your data might contain `null` values, use [make_list_with_nulls](make-list-with-nulls-aggregation-function.md) instead of [make_list](make-list-aggregation-function.md).
115125
116-
## Example 4 - Controlling location of `null` values
126+
### Control location of `null` values
117127

118128
By default, `null` values are put last in the sorted array. However, you can control it explicitly by adding a `bool` value as the last argument to `array_sort_asc()`.
119129

120-
Example with default behavior:
130+
The following example shows the default behavior:
121131

122132
:::moniker range="azure-data-explorer"
123133
> [!div class="nextstepaction"]
124-
> <a href="https://dataexplorer.azure.com/clusters/help/databases/Samples?query=H4sIAAAAAAAAAysoyswrUUgsKkqsjC/OLyqJTyxO1kipzEvMzUzWiM4rzcnRUUrKKU1V0lGqTM3JyS8HMtKLUlPzlHRAkrGamgDOvUliQgAAAA==" target="_blank">Run the query</a>
134+
> <a href="https://dataexplorer.azure.com/clusters/help/databases/Samples?query=H4sIAAAAAAAAAysoyswrUShKLS7NKbFNLCpKrIwvzi8qiU8sTtZIqcxLzM1M1ojOK83J0VFKyilNVdJRqkzNyckvBzLSi1JT85R0QJKxmpoApOe8zkkAAAA%3D" target="_blank">Run the query</a>
125135
::: moniker-end
126136

127137
```kusto
128-
print array_sort_asc(dynamic([null,"blue","yellow","green",null]))
138+
print result=array_sort_asc(dynamic([null,"blue","yellow","green",null]))
129139
```
130140

131141
**Output**
132142

133-
|print_0|
143+
|result|
134144
|---|
135145
|["blue","green","yellow",null,null]|
136146

137-
Example with non-default behavior:
147+
The following example shows nondefault behavior using the `false` parameter, which specifies that nulls are placed at the beginning of the array.
138148

139149
:::moniker range="azure-data-explorer"
140150
> [!div class="nextstepaction"]
141-
> <a href="https://dataexplorer.azure.com/clusters/help/databases/Samples?query=H4sIAAAAAAAAAxXJUQqAIAwA0KvIvhR2owhZtkJYMzYlvH319+DdVrUHMqOZvVnP5CXuU+mqJS46RBA2GQwIk0Xa8+E0ZgX8c00YDhLn9ALNIgvjSQAAAA==" target="_blank">Run the query</a>
151+
> <a href="https://dataexplorer.azure.com/clusters/help/databases/Samples?query=H4sIAAAAAAAAAxXJUQqAIAwA0KvEvhR2hU4SIctWCGvGpoS3r%2F4evNuKtsnYu7SZzGgkr9YSeQ77ULpKDot2EYRNOgPCYJH6fDiNWQH%2FXCNOB4lzfAFnY7HmUAAAAA%3D%3D" target="_blank">Run the query</a>
142152
::: moniker-end
143153

144154
```kusto
145-
print array_sort_asc(dynamic([null,"blue","yellow","green",null]), false)
155+
print result=array_sort_asc(dynamic([null,"blue","yellow","green",null]), false)
146156
```
147157

148158
**Output**
149159

150-
|`print_0`|
160+
|result|
151161
|---|
152162
|[null,null,"blue","green","yellow"]|
153163

154164
## Related content
155165

156-
To sort the first array in descending order, use [array_sort_desc()](array-sort-desc-function.md).
166+
* [Aggregation function types at a glance](aggregation-functions.md)
167+
* [array_sort_desc()](array-sort-desc-function.md)
168+
* [strcat_array()](strcat-array-function.md)
169+

data-explorer/kusto/query/array-sort-desc-function.md

Lines changed: 33 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: array_sort_desc()
33
description: Learn how to use the array_sort_desc() function to sort arrays in descending order.
44
ms.reviewer: slneimer
55
ms.topic: reference
6-
ms.date: 08/11/2024
6+
ms.date: 02/02/2025
77
---
88
# array_sort_desc()
99

@@ -34,14 +34,20 @@ Returns the same number of arrays as in the input, with the first array sorted i
3434

3535
`null` is returned for every array that differs in length from the first one.
3636

37-
If an array contains elements of different types, it's sorted in the following order:
37+
An array which contains elements of different types, is sorted in the following order:
3838

3939
* Numeric, `datetime`, and `timespan` elements
4040
* String elements
4141
* Guid elements
4242
* All other elements
4343

44-
## Example 1 - Sorting two arrays
44+
## Examples
45+
46+
The examples in this section show how to use the syntax to help you get started.
47+
48+
### Sort two arrays
49+
50+
The following example sorts the initial array, `array1`, in descending order. It then sorts `array2` to match the new order of `array1`.
4551

4652
:::moniker range="azure-data-explorer"
4753
> [!div class="nextstepaction"]
@@ -61,17 +67,19 @@ print array_sort_desc(array1,array2)
6167
|[5,4,3,2,1]|["d","c","b","e","a"]|
6268

6369
> [!NOTE]
64-
> The output column names are generated automatically, based on the arguments to the function. To assign different names to the output columns, use the following syntax: `... | extend (out1, out2) = array_sort_desc(array1,array2)`
70+
> The output column names are generated automatically, based on the arguments to the function. To assign different names to the output columns, use the following syntax: `... | extend (out1, out2) = array_sort_desc(array1,array2)`.
71+
72+
## Sort substrings
6573

66-
## Example 2 - Sorting substrings
74+
The following example sorts a list of names in descending order. It saves a list of names to a variable, `Names`, which is then splits into an array and sorted in descending order. The query returns the names in descending order.
6775

6876
:::moniker range="azure-data-explorer"
6977
> [!div class="nextstepaction"]
70-
> <a href="https://dataexplorer.azure.com/clusters/help/databases/Samples?query=H4sIAAAAAAAAA8tJLVHwS8xNLVawVVDyys/I0wlILM3RcU/NL0pP1QnKzEvPV7LmygGqCs4vKklNgaktLilKTiyJTywqSqzUAJPxxUAF8SmpxckaxQU5mSUaYKU6Cko6SpqaEMqaq6AoM69EoSi1uDSnBGgKkpkA+RSmRokAAAA=" target="_blank">Run the query</a>
78+
> <a href="https://dataexplorer.azure.com/clusters/help/databases/Samples?query=H4sIAAAAAAAAA8tJLVHwS8xNLVawVVDyys%2FI0wlILM3R8UrMS9XxTqzMV7Lm5coBqgnOLypJTYGpLC4pSk4siU8sKkqs1ACT8cVABfEpqcXJGsUFOZklGmClOgpKOkqamhAKaFJBUWZeiUJRanFpTgnQGCRDAeUAGb%2BIAAAA" target="_blank">Run the query</a>
7179
::: moniker-end
7280

7381
```kusto
74-
let Names = "John, Paul, George, Ringo";
82+
let Names = "John,Paul,Jane,Kayo";
7583
let SortedNames = strcat_array(array_sort_desc(split(Names, ",")), ",");
7684
print result = SortedNames
7785
```
@@ -80,9 +88,11 @@ print result = SortedNames
8088

8189
|result|
8290
|---|
83-
|Ringo, Paul, John, George|
91+
|Paul,Kayo,John,Jane|
8492

85-
## Example 3 - Combining summarize and array_sort_desc
93+
### Combine summarize and array_sort_desc
94+
95+
The following example uses the `summarize` operator and the `array_sort_asc` function to organize and sort commands by user in descending chronological order.
8696

8797
:::moniker range="azure-data-explorer"
8898
> [!div class="nextstepaction"]
@@ -113,46 +123,48 @@ datatable(command:string, command_time:datetime, user_id:string)
113123
|user2|[<br> "pwd",<br> "rm"<br>]|
114124

115125
> [!NOTE]
116-
> If your data may contain `null` values, use [make_list_with_nulls](make-list-with-nulls-aggregation-function.md) instead of [make_list](make-list-aggregation-function.md).
126+
> If your data can contain `null` values, use [make_list_with_nulls](make-list-with-nulls-aggregation-function.md) instead of [make_list](make-list-aggregation-function.md).
117127
118-
## Example 4 - Controlling location of `null` values
128+
### Control location of `null` values
119129

120-
By default, `null` values are put last in the sorted array. However, you can control it explicitly by adding a `bool` value as the last argument to `array_sort_desc()`.
130+
By default, `null` values are put last in the sorted array. However, you can control it explicitly by adding a `bool` value as the last argument to `array_sort_asc()`.
121131

122-
Example with default behavior:
132+
The following example shows the default behavior:
123133

124134
:::moniker range="azure-data-explorer"
125135
> [!div class="nextstepaction"]
126-
> <a href="https://dataexplorer.azure.com/clusters/help/databases/Samples?query=H4sIAAAAAAAAAysoyswrUUgsKkqsjC/OLyqJT0ktTtZIqcxLzM1M1ojOK83J0VFKyilNVdJRqkzNyckvBzLSi1JT85R0QJKxmpoAGsR2QUMAAAA=" target="_blank">Run the query</a>
136+
> <a href="https://dataexplorer.azure.com/clusters/help/databases/Samples?query=H4sIAAAAAAAAAysoyswrUShKLS7NKbFNLCpKrIwvzi8qiU9JLU7WSKnMS8zNTNaIzivNydFRSsopTVXSUapMzcnJLwcy0otSU%2FOUdECSsZqaAAa5vexKAAAA" target="_blank">Run the query</a>
127137
::: moniker-end
128138

129139
```kusto
130-
print array_sort_desc(dynamic([null,"blue","yellow","green",null]))
140+
print result=array_sort_desc(dynamic([null,"blue","yellow","green",null]))
131141
```
132142

133143
**Output**
134144

135-
|`print_0`|
145+
|result|
136146
|---|
137147
|["yellow","green","blue",null,null]|
138148

139-
Example with nondefault behavior:
149+
The following example shows nondefault behavior using the `false` parameter, which specifies that nulls are placed at the beginning of the array.
140150

141151
:::moniker range="azure-data-explorer"
142152
> [!div class="nextstepaction"]
143-
> <a href="https://dataexplorer.azure.com/?query=H4sIAAAAAAAAAxXJUQqAIAwA0KvIvhR2owhZukKYM6YS3r76e/BuKzocmdGKvdmImXvyeSnVkvymUwThkMmAsFikPR8uY1bAP/eA7iTpHF4VdlwBSgAAAA==" target="_blank">Run the query</a>
153+
> <a href="https://dataexplorer.azure.com/clusters/help/databases/Samples?query=H4sIAAAAAAAAAxXJUQqAIAwA0KvIvhR2hU4SIaYrhDVjU8LbV38P3q1VulOywX1JqmlGa9pjIcu%2BTElXzX6VwYyw8yBAmMTcng%2BnEgngn1tAdyQ2Ci%2Bihlo3UQAAAA%3D%3D" target="_blank">Run the query</a>
144154
::: moniker-end
145155

146156
```kusto
147-
print array_sort_desc(dynamic([null,"blue","yellow","green",null]), false)
157+
print result=array_sort_desc(dynamic([null,"blue","yellow","green",null]), false)
148158
```
149159

150160
**Output**
151161

152-
|`print_0`|
162+
|result|
153163
|---|
154164
|[null,null,"yellow","green","blue"]|
155165

156166
## Related content
157167

158-
To sort the first array in ascending order, use [array_sort_asc()](array-sort-asc-function.md).
168+
* [Aggregation function types at a glance](aggregation-functions.md)
169+
* [array_sort_asc()](array-sort-asc-function.md)
170+
* [strcat_array()](strcat-array-function.md)

0 commit comments

Comments
 (0)