Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
050a24f
Standardize Example section
hzargari-ms May 12, 2025
ce4a5b6
Standardize Examples section
hzargari-ms May 13, 2025
7b9ca99
Standardize Examples section
hzargari-ms May 13, 2025
2fc8ee2
Standardize Examples section
hzargari-ms May 13, 2025
ec4d989
Standardize Examples section
hzargari-ms May 13, 2025
6cb3622
Standardize Examples section
hzargari-ms May 13, 2025
84d1613
Standardize Examples section
hzargari-ms May 15, 2025
5b4ac0f
Revised examples section
hzargari-ms May 15, 2025
18e198a
Revised Examples section
hzargari-ms May 15, 2025
3727140
Revised Examples section
hzargari-ms May 18, 2025
50a105d
Revised Examples section
hzargari-ms May 18, 2025
a6bfeb6
Revised Examples section
hzargari-ms May 18, 2025
3aaea75
Revised Examples section
hzargari-ms May 18, 2025
de9f418
Revised Examples section
hzargari-ms May 18, 2025
8118833
Standardize Examples section
hzargari-ms May 18, 2025
9713b8b
Standardize Examples section
hzargari-ms May 18, 2025
2122816
Merge branch 'main' of https://github.com/MicrosoftDocs/dataexplorer-…
hzargari-ms May 25, 2025
fc734a7
Fixed examples sub-sections
hzargari-ms May 25, 2025
da4eea6
bookmark fix
hzargari-ms May 25, 2025
f7e210a
Merge branch 'main' of https://github.com/MicrosoftDocs/dataexplorer-…
hzargari-ms May 25, 2025
4d5acc4
Merge pull request #6822 from hzargari-ms/wi-430862-examples-batch-4
JillGrant615 May 25, 2025
330322d
Merge pull request #6826 from hzargari-ms/wi-430862-examples-batch-6
JillGrant615 May 25, 2025
ee58658
Merge pull request #6828 from hzargari-ms/wi-430862-examples-batch-9
JillGrant615 May 25, 2025
f37f8e5
Merge pull request #6830 from hzargari-ms/wi-430862-examples-batch-11
JillGrant615 May 25, 2025
98fa57d
Merge pull request #6831 from hzargari-ms/wi-430862-examples-batch-12
JillGrant615 May 25, 2025
7d93c73
Merge pull request #6835 from hzargari-ms/wi-430862-examples-batch-13
JillGrant615 May 25, 2025
aff592e
Merge pull request #6840 from hzargari-ms/wi-430862-examples-batch-16
JillGrant615 May 25, 2025
15936bc
Merge pull request #6842 from hzargari-ms/wi-430862-examples-batch-18
JillGrant615 May 25, 2025
962bc2d
Merge pull request #6870 from MicrosoftDocs/main
JillGrant615 May 25, 2025
7aac6b2
Merging changes synced from https://github.com/MicrosoftDocs/dataexpl…
May 25, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions data-explorer/kusto/query/bag-set-key-function.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Returns a `dynamic` property-bag with specified key-value pairs. If the input ba

## Examples

### Use a root-level key
The following example demonstrates how to set a root-level key in a property bag.

:::moniker range="azure-data-explorer"
> [!div class="nextstepaction"]
Expand All @@ -54,7 +54,8 @@ datatable(input: dynamic) [
|{<br> "key1": 1,<br> "key2": 2<br>}|{<br> "key1": 1,<br> "key2": 2,<br> "key3": 3<br>}|
|{<br> "key1": 1,<br> "key3": "abc"<br>}|{<br> "key1": 1,<br> "key3": 3<br>}|

### Use a JSONPath key
The following example demonstrates how to set a JSONPath key in a property bag.


:::moniker range="azure-data-explorer"
> [!div class="nextstepaction"]
Expand Down
19 changes: 6 additions & 13 deletions data-explorer/kusto/query/bag-unpack-plugin.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ The `bag_unpack` plugin returns a table with as many records as its tabular inpu

## Examples

### Expand a bag
The following example demonstrates how to expand a bag.

:::moniker range="azure-data-explorer"
> [!div class="nextstepaction"]
Expand All @@ -85,9 +85,7 @@ datatable(d:dynamic)
|40 |Dave |
|30 |Jasmine|

### Expand a bag with OutputColumnPrefix

Expand a bag and use the `OutputColumnPrefix` option to produce column names that begin with the prefix 'Property_'.
The following example demonstrates how to expand a bag and use the `OutputColumnPrefix` option to produce column names that begin with the prefix 'Property_'.

:::moniker range="azure-data-explorer"
> [!div class="nextstepaction"]
Expand All @@ -112,9 +110,7 @@ datatable(d:dynamic)
|40 |Dave |
|30 |Jasmine |

### Expand a bag with columnsConflict

Expand a bag and use the `columnsConflict` option to resolve conflicts between existing columns and columns produced by the `bag_unpack()` operator.
The following example demonstrates how to expand a bag and use the `columnsConflict` option to resolve conflicts between existing columns and columns produced by the `bag_unpack()` operator.

:::moniker range="azure-data-explorer"
> [!div class="nextstepaction"]
Expand Down Expand Up @@ -162,9 +158,8 @@ datatable(Name:string, d:dynamic)
|40 |Old_name |
|30 |Old_name |

### Expand a bag with ignoredProperties

Expand a bag and use the `ignoredProperties` option to ignore certain properties in the property bag.
The following example demonstrates how to expand a bag and use the `ignoredProperties` option to ignore certain properties in the property bag.

:::moniker range="azure-data-explorer"
> [!div class="nextstepaction"]
Expand All @@ -190,9 +185,7 @@ datatable(d:dynamic)
|Dave|
|Jasmine|

### Expand a bag with a query-defined OutputSchema

Expand a bag and use the `OutputSchema` option to allow various optimizations to be evaluated before running the actual query.
The following example demonstrates how to expand a bag and use the `OutputSchema` option to allow various optimizations to be evaluated before running the actual query.

:::moniker range="azure-data-explorer"
> [!div class="nextstepaction"]
Expand All @@ -217,7 +210,7 @@ datatable(d:dynamic)
|Dave | 40 |
|Jasmine | 30 |

Expand a bag and use the `OutputSchema` option to allow various optimizations to be evaluated before running the actual query. Use a wildcard `*` to return all columns of the input table.
The following example demonstrates how to expand a bag and use the `OutputSchema` option to allow various optimizations to be evaluated before running the actual query. Use a wildcard `*` to return all columns of the input table.

:::moniker range="azure-data-explorer"
> [!div class="nextstepaction"]
Expand Down
22 changes: 6 additions & 16 deletions data-explorer/kusto/query/bag-zip.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Returns a [dynamic](scalar-data-types/dynamic.md) property-bag.

## Examples

In the following example, the array of keys and the array of values are the same length and are zipped together into a dynamic property bag.
The following example shows how to use `bag_zip()` to create a property-bag from two arrays. The first array contains the keys, and the second array contains the values. The resulting property-bag contains the keys and values zipped together.

:::moniker range="azure-data-explorer"
> [!div class="nextstepaction"]
Expand All @@ -55,9 +55,7 @@ Data
|--|--|--|
| ['a','b','c'] | [1,'2',3.4] | {'a': 1,'b': '2','c': 3.4} |

### More keys than values

In the following example, the array of keys is longer than the array of values. The missing values are filled with nulls.
The following example shows how to use `bag_zip()` when the arrays have different lengths. In this case, the resulting property-bag contains null values for the missing keys.

:::moniker range="azure-data-explorer"
> [!div class="nextstepaction"]
Expand All @@ -76,9 +74,7 @@ Data
|--|--|--|
| ['a','b','c'] | [1,'2'] | {'a': 1,'b': '2','c': null} |

### More values than keys

In the following example, the array of values is longer than the array of keys. Values with no matching keys are ignored.
The following example shows how to use `bag_zip()` when the arrays have different lengths. In this case, the resulting property-bag contains null values for the missing keys.

:::moniker range="azure-data-explorer"
> [!div class="nextstepaction"]
Expand All @@ -97,9 +93,7 @@ Data
|--|--|--|
| ['a','b'] | [1,'2',2.5] | {'a': 1,'b': '2'} |

### Non-string keys

In the following example, there are some values in they keys array that aren't of type string. The non-string values are ignored.
The following example demonstrates how `bag_zip()` handles cases where the keys array contains non-string values. Any key that isn't a string is excluded from the resulting property-bag.

:::moniker range="azure-data-explorer"
> [!div class="nextstepaction"]
Expand All @@ -118,9 +112,7 @@ Data
|--|--|--|
| ['a',8,'b'] | [1,'2',2.5] | {'a': 1,'b': 2.5} |

### Fill values with null

In the following example, the parameter that is supposed to be an array of values isn't an array, so all values are filled with nulls.
The following example demonstrates how `bag_zip()` behaves when the parameter intended to be an array of values is not actually an array. In this case, all resulting property values are set to null.

:::moniker range="azure-data-explorer"
> [!div class="nextstepaction"]
Expand All @@ -139,9 +131,7 @@ Data
|--|--|--|
| ['a',8,'b'] | 1 | {'a': null,'b': null} |

### Null property-bag

In the following example, the parameter that is supposed to be an array of keys isn't an array, so the resulting property-bag is null.
The following example demonstrates how `bag_zip()` behaves when the parameter intended to be an array of keys is not actually an array. In this case, the resulting property-bag is null.

:::moniker range="azure-data-explorer"
> [!div class="nextstepaction"]
Expand Down
4 changes: 3 additions & 1 deletion data-explorer/kusto/query/base64-decode-toarray-function.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ Decodes a base64 string to an array of long values.

Returns an array of long values decoded from a base64 string.

## Example
## Examples

The following example shows how to use `base64_decode_toarray()` to decode a base64 string into an array of long values.

:::moniker range="azure-data-explorer"
> [!div class="nextstepaction"]
Expand Down
4 changes: 3 additions & 1 deletion data-explorer/kusto/query/base64-decode-toguid-function.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ Decodes a base64 string to a [GUID](scalar-data-types/guid.md).

Returns a [GUID](scalar-data-types/guid.md) decoded from a base64 string.

## Example
## Examples

The following example shows how to use `base64_decode_toguid()` to decode a base64 string into a GUID.

:::moniker range="azure-data-explorer"
> [!div class="nextstepaction"]
Expand Down
4 changes: 3 additions & 1 deletion data-explorer/kusto/query/base64-decode-tostring-function.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ Decodes a base64 string to a UTF-8 string.

Returns UTF-8 string decoded from base64 string.

## Example
## Examples

The following example shows how to use `base64_decode_tostring()` to decode a base64 string into a UTF-8 string.

:::moniker range="azure-data-explorer"
> [!div class="nextstepaction"]
Expand Down
2 changes: 2 additions & 0 deletions data-explorer/kusto/query/base64-encode-fromarray-function.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ Returns the base64 string encoded from the bytes array. Note that byte is an int

## Examples

The following example shows how to use `base64_encode_fromarray()` to encode a bytes array into a base64 string.

:::moniker range="azure-data-explorer"
> [!div class="nextstepaction"]
> <a href="https://dataexplorer.azure.com/clusters/help/databases/Samples?query=H4sIAAAAAAAAA8tJLVFIqixJLY5PLCpKrFSwVSjJL05OzEks0igoyswDSiYWp5qZxKekJuenpMaX5IOVaSgFG4dVpbhb2CppalpzQVRClKTEQ3UUlwBF04EGQvmpeWAT0orycyFmIFmrCQCPOEFEhwAAAA==" target="_blank">Run the query</a>
Expand Down
4 changes: 3 additions & 1 deletion data-explorer/kusto/query/base64-encode-fromguid-function.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ Encodes a [GUID](scalar-data-types/guid.md) to a base64 string.

Returns a base64 string encoded from a GUID.

## Example
## Examples

The following example shows how to use `base64_encode_fromguid()` to encode a GUID into a base64 string.

:::moniker range="azure-data-explorer"
> [!div class="nextstepaction"]
Expand Down
4 changes: 3 additions & 1 deletion data-explorer/kusto/query/base64-encode-tostring-function.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ Encodes a string as base64 string.

Returns *string* encoded as a base64 string.

## Example
## Examples

The following example shows how to use `base64_encode_tostring()` to encode a string into a base64 string.

:::moniker range="azure-data-explorer"
> [!div class="nextstepaction"]
Expand Down
6 changes: 4 additions & 2 deletions data-explorer/kusto/query/basket-plugin.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ Each pattern is represented by a row in the results. The first column is the seg
> [!NOTE]
> The algorithm uses sampling to determine the initial frequent values. Therefore, the results could slightly differ between multiple runs for patterns whose frequency is close to the threshold.

## Example
## Examples

The following example uses the `basket` plugin to find frequent patterns in the data.

:::moniker range="azure-data-explorer"
> [!div class="nextstepaction"]
Expand Down Expand Up @@ -66,7 +68,7 @@ StormEvents
|6|1310|22.3|||YES|
|7|1291|21.9||Thunderstorm Wind||

### Example with custom wildcards
The following example demonstrates using the `basket` plugin with a weight column and custom wildcards to find frequent patterns.

:::moniker range="azure-data-explorer"
> [!div class="nextstepaction"]
Expand Down
10 changes: 5 additions & 5 deletions data-explorer/kusto/query/between-operator.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@ Filters a record set for data matching the values in an inclusive range.
| *T* | `string` | :heavy_check_mark: | The tabular input whose records are to be matched. For example, the table name. |
| *expr* | scalar | :heavy_check_mark: | The expression used to filter. |
| *leftRange* | int, long, real, or datetime | :heavy_check_mark: | The expression of the left range. The range is inclusive.|
| *rightRange* | int, long, real, datetime, or timespan | :heavy_check_mark: | The expression of the right range. The range is inclusive.<br/><br/>This value can only be of type [timespan](scalar-data-types/timespan.md) if *expr* and *leftRange* are both of type `datetime`. See [example](#filter-using-a-timespan-range).|
| *rightRange* | int, long, real, datetime, or timespan | :heavy_check_mark: | The expression of the right range. The range is inclusive.<br><br/>This value can only be of type [timespan](scalar-data-types/timespan.md) if *expr* and *leftRange* are both of type `datetime`. See [examples](#examples).|

## Returns

Rows in *T* for which the predicate of (*expr* >= *leftRange* and *expr* <= *rightRange*) evaluates to `true`.

## Examples

### Filter numeric values
In the following example, the rows are filtered by numeric values.

:::moniker range="azure-data-explorer"
> [!div class="nextstepaction"]
Expand All @@ -57,7 +57,7 @@ range x from 1 to 100 step 1
|54|
|55|

### Filter by date
In the following example, the rows are filtered by date.

:::moniker range="azure-data-explorer"
> [!div class="nextstepaction"]
Expand All @@ -76,7 +76,7 @@ StormEvents
|---|
|476|

### Filter by date and time
In the following example, the rows are filtered by date and time.

:::moniker range="azure-data-explorer"
> [!div class="nextstepaction"]
Expand All @@ -95,7 +95,7 @@ StormEvents
|---|
|301|

### Filter using a timespan range
In the following example, the rows are filtered using a timespan range.

:::moniker range="azure-data-explorer"
> [!div class="nextstepaction"]
Expand Down
5 changes: 3 additions & 2 deletions data-explorer/kusto/query/bitset-count-ones-function.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ ms.date: 08/11/2024

> [!INCLUDE [applies](../includes/applies-to-version/applies.md)] [!INCLUDE [fabric](../includes/applies-to-version/fabric.md)] [!INCLUDE [azure-data-explorer](../includes/applies-to-version/azure-data-explorer.md)] [!INCLUDE [monitor](../includes/applies-to-version/monitor.md)] [!INCLUDE [sentinel](../includes/applies-to-version/sentinel.md)]

Returns the number of set bits in the binary representation of a number.
Performs a bitwise operation on the binary representation of a number.


## Syntax

Expand All @@ -27,7 +28,7 @@ Returns the number of set bits in the binary representation of a number.

Returns the number of set bits in the binary representation of a number.

## Example
## Examples

:::moniker range="azure-data-explorer"
> [!div class="nextstepaction"]
Expand Down
4 changes: 2 additions & 2 deletions data-explorer/kusto/query/buildschema-aggregation-function.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Returns the minimal schema that admits all values of *DynamicExpr*.
> [!TIP]
> If the input is a JSON string, use the [parse_json()](parse-json-function.md) function to convert the JSON to a [dynamic](scalar-data-types/dynamic.md) value. Otherwise, an error might occur.

## Example
## Examples

The following example builds a schema based on:

Expand All @@ -54,7 +54,7 @@ datatable(value: dynamic) [
| summarize buildschema(value)
```

**Results**
**Output**

|schema_value|
|--|
Expand Down
2 changes: 1 addition & 1 deletion data-explorer/kusto/query/case-function.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ All `then` arguments and the `else` argument must be of the same type.

The value of the first *then_i* whose *predicate_i* evaluates to `true`, or the value of *else* if neither of the predicates are satisfied.

## Example
## Examples

:::moniker range="azure-data-explorer"
> [!div class="nextstepaction"]
Expand Down
11 changes: 4 additions & 7 deletions data-explorer/kusto/query/cluster-function.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,8 @@ Changes the reference of the query to a remote Eventhouse. To access a database
## Examples

:::moniker range="azure-data-explorer"
### Use cluster() to access remote cluster

The following query can be run on any cluster.
The following example shows how to use the `cluster()` function to access a remote cluster.
The query can be run on any cluster.

> [!div class="nextstepaction"]
> <a href="https://dataexplorer.azure.com/clusters/help/databases/SampleLogs?query=H4sIAAAAAAAAA0vOKS0uSS3SUM9IzSlQ19RLSSxJTEosTtVQD07MLchJLQaKBZfkF+W6lqXmlRQr1Cgk55fmlQAAayjLjjcAAAA=" target="_blank">Run the query</a>
Expand All @@ -57,9 +56,9 @@ cluster('help.kusto.windows.net').database('Samples').StormEvents | count
:::moniker-end

:::moniker range="microsoft-fabric"
### Use cluster() to access remote Eventhouse

The following query can be run on any Eventhouse.
The following example shows how to use the `cluster()` function to access a remote Eventhouse.
The query can be run on any Eventhouse.

```kusto
cluster('help').database('Samples').StormEvents | count
Expand All @@ -74,7 +73,6 @@ cluster('help.kusto.windows.net').database('Samples').StormEvents | count
|---|
|59066|

### Use cluster() inside let statements

The previous query can be rewritten to use a query-defined function (`let` statement) that takes a parameter called `clusterName` and passes it to the `cluster()` function.

Expand All @@ -97,7 +95,6 @@ foo('help')
|---|
|59066|

### Use cluster() inside Functions

The same query as above can be rewritten to be used in a function that receives a parameter `clusterName` - which is passed into the cluster() function.

Expand Down
2 changes: 1 addition & 1 deletion data-explorer/kusto/query/coalesce-function.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Evaluates a list of expressions and returns the first non-null (or non-empty for

The value of the first *arg* whose value isn't null (or not-empty for string expressions).

## Example
## Examples

:::moniker range="azure-data-explorer"
> [!div class="nextstepaction"]
Expand Down
2 changes: 1 addition & 1 deletion data-explorer/kusto/query/column-ifexists-function.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Displays the column, if the column exists. Otherwise, it returns the default col

If *columnName* exists, then returns the column. Otherwise, it returns the *defaultValue* column.

## Example
## Examples

This example returns the default **State** column, because a column named Capital doesn't exist in the *StormEvents* table.

Expand Down
4 changes: 2 additions & 2 deletions data-explorer/kusto/query/comment.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ Use the two slashes (//) to add comments. The following table lists the keyboard
| `Ctrl`+`K`+`C` | Comment current line or selected lines. |
| `Ctrl`+`K`+`U` | Uncomment current line or selected lines. |

## Example
## Examples

This example returns a count of events in the New York state:
The following example illustrates two styles of comments: a nested comment at the end of a line and a standalone comment on its own line. The query counts the number of events in the state of New York.

:::moniker range="azure-data-explorer"
> [!div class="nextstepaction"]
Expand Down
Loading