diff --git a/data-explorer/kusto/query/bag-unpack-plugin.md b/data-explorer/kusto/query/bag-unpack-plugin.md index a714c412c1..b7c876217a 100644 --- a/data-explorer/kusto/query/bag-unpack-plugin.md +++ b/data-explorer/kusto/query/bag-unpack-plugin.md @@ -87,7 +87,7 @@ datatable(d:dynamic) **Output** -|Age|Name | +|`Age`|`Name`| |---|-------| |20 |John | |40 |Dave | @@ -112,7 +112,7 @@ datatable(d:dynamic) **Output** -|Property_Age|Property_Name| +|`Property_Age`|`Property_Name`| |------------|-------------| |20 |John | |40 |Dave | @@ -122,49 +122,49 @@ datatable(d:dynamic) :::moniker range="azure-data-explorer" > [!div class="nextstepaction"] -> Run the query +> Run the query ::: moniker-end ```kusto datatable(Name:string, d:dynamic) [ - 'Old_name', dynamic({"Name": "John", "Age":20}), - 'Old_name', dynamic({"Name": "Dave", "Age":40}), - 'Old_name', dynamic({"Name": "Jasmine", "Age":30}), + 'James', dynamic({"Name": "John", "Age":20}), + 'David', dynamic({ "Age":40}), + 'Emily', dynamic({"Name": "Jasmine", "Age":30}), ] -| evaluate bag_unpack(d, columnsConflict='replace_source') // Use new name +| evaluate bag_unpack(d, columnsConflict='replace_source') // Replace old column Name by new column ``` **Output** -|Age|Name | -|---|-------| -|20 |John | -|40 |Dave | -|30 |Jasmine| +|`Name`|`Age`| +|---|---| +|John |20 | +| |40 | +|Jasmine |30 | :::moniker range="azure-data-explorer" > [!div class="nextstepaction"] -> Run the query +> Run the query ::: moniker-end ```kusto datatable(Name:string, d:dynamic) [ - 'Old_name', dynamic({"Name": "John", "Age":20}), - 'Old_name', dynamic({"Name": "Dave", "Age":40}), - 'Old_name', dynamic({"Name": "Jasmine", "Age":30}), + 'James', dynamic({"Name": "John", "Age":20}), + 'David', dynamic({"Name": "Dave", "Age":40}), + 'Emily', dynamic({"Name": "Jasmine", "Age":30}), ] -| evaluate bag_unpack(d, columnsConflict='keep_source') // Keep old name +| evaluate bag_unpack(d, columnsConflict='keep_source') // Keep old column Name ``` **Output** -|Age|Name | -|---|---------| -|20 |Old_name | -|40 |Old_name | -|30 |Old_name | +|`Name`|`Age`| +|---|--| +|James |20 | +|David |40 | +|Emily |30 | **Expand a bag and use the `ignoredProperties` option to ignore 2 of the properties in the property bag**: @@ -186,7 +186,7 @@ datatable(d:dynamic) **Output** -|Name| +|`Name`| |---| |John| |Dave| @@ -211,7 +211,7 @@ datatable(d:dynamic) **Output** -|Age |Height |Name | +|`Age` |`Height` |`Name` | |--|--|--| | 20 | | John | | 40 | 170 | Dave | @@ -238,7 +238,7 @@ datatable(d:dynamic, Description: string) **Output** -|Description|Name|Age| +|Description|`Name`|`Age`| |---|---|---| |Student|John|20| |Teacher|Dave|40| @@ -282,8 +282,9 @@ datatable(d:dynamic, Description: string) The output is the same for both queries. The first 10 rows of the output are shown below. -| Canada | British Columbia | 56,101,083 | +|`Country/Region`|`State`|`Sales`| |--|--|--| +| Canada | British Columbia | 56,101,083 | | United Kingdom | England | 77,288,747 | | Australia | Victoria | 31,242,423 | | Australia | Queensland | 27,617,822 | diff --git a/data-explorer/kusto/query/pack-all-function.md b/data-explorer/kusto/query/pack-all-function.md index 0d784228a4..e3f640cf42 100644 --- a/data-explorer/kusto/query/pack-all-function.md +++ b/data-explorer/kusto/query/pack-all-function.md @@ -48,12 +48,12 @@ datatable(Source:string,Target:string,CharsCount:long) **Output** -|Source |Target | CharsCount | Packed |PackedIgnoreNullEmpty| +|Source |Target | CharsCount | `Packed` | `PackedIgnoreNullEmpty` | |---|---|---|---|---| -|555-1234 |555-1212 | 46 |{"Source":"555-1234", "Target":"555-1212", "CharsCount": 46} | {"Source":"555-1234", "Target":"555-1212", "CharsCount": 46}| -|555-1234 |555-1213 | 50 |{"Source":"555-1234", "Target":"555-1213", "CharsCount": 50} | {"Source":"555-1234", "Target":"555-1213", "CharsCount": 50}| -|555-1313 | | 42 | {"Source":"555-1313", "Target":"", "CharsCount": 42} | {"Source":"555-1313", "CharsCount": 42}| -| |555-3456 | 74 | {"Source":"", "Target":"555-3456", "CharsCount": 74} | {"Target":"555-3456", "CharsCount": 74}| +|555-1234 |555-1212 | 46 |{
"Source":"555-1234",
"Target":"555-1212",
"CharsCount": 46
} | {
"Source":"555-1234",
"Target":"555-1212",
"CharsCount": 46
}| +|555-1234 |555-1213 | 50 |{
"Source":"555-1234",
"Target":"555-1213",
"CharsCount": 50
} | {
"Source":"555-1234",
"Target":"555-1213",
"CharsCount": 50
}| +|555-1313 | | 42 | {
"Source":"555-1313",
"Target":"",
"CharsCount": 42
} | {
"Source":"555-1313",
"CharsCount": 42
}| +| |555-3456 | 74 | {
"Source":"",
"Target":"555-3456",
"CharsCount": 74
} | {
"Target":"555-3456",
"CharsCount": 74
}| > [!NOTE] > There's a difference between the *Packed* and the *PackedIgnoreNullEmpty* columns in the last two rows of the example. These two rows included empty values that were ignored by *pack_all(true)*. diff --git a/data-explorer/kusto/query/pack-function.md b/data-explorer/kusto/query/pack-function.md index d7574a9c31..b3c9789e69 100644 --- a/data-explorer/kusto/query/pack-function.md +++ b/data-explorer/kusto/query/pack-function.md @@ -80,7 +80,7 @@ datatable ( **Results** -|MyBag|MyBag_Dest|MyBag_Text| +|`MyBag`|`MyBag_Dest`|`MyBag_Text`| |--|--|--| |{"Dest":100,"Text":"Hi" }|100|Hi| |{"Dest":200,"Text":"Hello" }|200|Hello| @@ -100,7 +100,7 @@ SmsMessages MmsMessages -|SourceNumber |TargetNumber| AttachmentSize | AttachmentType | AttachmentName | +|SourceNumber |TargetNumber| FileSize | FileType | FileName | |---|---|---|---|---| |555-555-1212 |555-555-1213 | 200 | jpeg | Pic1 | |555-555-1234 |555-555-1212 | 250 | jpeg | Pic2 | @@ -108,7 +108,7 @@ MmsMessages :::moniker range="azure-data-explorer" > [!div class="nextstepaction"] -> Run the query +> Run the query ::: moniker-end ```kusto @@ -124,29 +124,28 @@ let SmsMessages = datatable ( let MmsMessages = datatable ( SourceNumber: string, TargetNumber: string, - AttachmentSize: string, - AttachmentType: string, - AttachmentName: string + FileSize: string, + FileName: string ) [ - "555-555-1212", "555-555-1213", "200", "jpeg", "Pic1", - "555-555-1234", "555-555-1212", "250", "jpeg", "Pic2", - "555-555-1234", "555-555-1213", "300", "png", "Pic3" + "555-555-1212", "555-555-1213", "200", "Pic1", + "555-555-1234", "555-555-1212", "250", "Pic2", + "555-555-1234", "555-555-1213", "300", "Pic3" ]; SmsMessages | join kind=inner MmsMessages on SourceNumber -| extend Packed=bag_pack("CharsCount", CharsCount, "AttachmentSize", AttachmentSize, "AttachmentType", AttachmentType, "AttachmentName", AttachmentName) +| extend Packed=bag_pack("CharsCount", CharsCount, "FileSize", FileSize, "FileName", FileName) | where SourceNumber == "555-555-1234" | project SourceNumber, TargetNumber, Packed ``` **Results** -| SourceNumber | TargetNumber | Packed | +| SourceNumber | TargetNumber | `Packed` | |--|--|--|--| -| 555-555-1234 | 555-555-1213 | {"CharsCount":"50","AttachmentSize":"250","AttachmentType":"jpeg","AttachmentName":"Pic2"} | -| 555-555-1234 | 555-555-1212 | {"CharsCount":"46","AttachmentSize":"250","AttachmentType":"jpeg","AttachmentName":"Pic2"} | -| 555-555-1234 | 555-555-1213 | {"CharsCount":"50","AttachmentSize":"300","AttachmentType":"png","AttachmentName":"Pic3"} | -| 555-555-1234 | 555-555-1212 | {"CharsCount":"46","AttachmentSize":"300","AttachmentType":"png","AttachmentName":"Pic3"} | +| 555-555-1234 | 555-555-1213 | {"CharsCount":"50","FileSize":"250","FileName":"Pic2"} | +| 555-555-1234 | 555-555-1212 | {"CharsCount":"46","FileSize":"250","FileName":"Pic2"} | +| 555-555-1234 | 555-555-1213 | {"CharsCount":"50","FileSize":"300","FileName":"Pic3"} | +| 555-555-1234 | 555-555-1212 | {"CharsCount":"46","FileSize":"300","FileName":"Pic3"} | ## Related content