你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn。
make_set()(聚合函数)
适用于:✅Microsoft Fabric✅Azure 数据资源管理器Azure Monitor✅Microsoft✅ Sentinel
创建一个 dynamic
数组,其中包含 expr 在组中提取的非重复值集。
空值会被忽略,不会纳入计算中。
注意
此函数与 summarize 运算符结合使用。
弃用的别名:makeset()
语法
make_set(
expr [,
maxSize])
详细了解语法约定。
参数
客户 | 类型 | 必需 | 说明 |
---|---|---|---|
expr | string |
✔️ | 用于聚合计算的表达式。 |
maxSize | int |
返回的最大元素数目。 默认值和最大值为 1048576。 |
注意
已弃用版本的默认 maxSize 限制为 128。
返回
返回一个 dynamic
数组,其中包含 expr 在组中提取的非重复值集。
数组的排序顺序未定义。
提示
若要仅对非重复值进行计数,请使用 dcount() 或 count_distinct()。
示例
从标量列设置
以下示例显示了按相同作物损失价值分组的一组州。
StormEvents
| summarize states=make_set(State) by DamageCrops
显示的结果表仅包括前 10 行。
损害农作物 | states |
---|---|
0 | ["NORTH CAROLINA","WISCONSIN","NEW YORK","ALASKA","DELAWARE","OKLAHOMA","INDIANA","ILLINOIS","MINNESOTA","SOUTH DAKOTA","TEXAS","UTAH","COLORADO","VERMONT","NEW JERSEY","VIRGINIA","CALIFORNIA","PENNSYLVANIA","MONTANA","WASHINGTON","OREGON","HAWAII","IDAHO","PUERTO RICO","MICHIGAN","FLORIDA","WYOMING","GULF OF MEXICO","NEVADA","LOUISIANA","TENNESSEE","KENTUCKY","MISSISSIPPI","ALABAMA","GEORGIA","SOUTH CAROLINA","OHIO","NEW MEXICO","ATLANTIC SOUTH","NEW HAMPSHIRE","ATLANTIC NORTH","NORTH DAKOTA","IOWA","NEBRASKA","WEST VIRGINIA","MARYLAND","KANSAS","MISSOURI","ARKANSAS","ARIZONA","MASSACHUSETTS","MAINE","CONNECTICUT","GUAM","HAWAII WATERS","AMERICAN SAMOA","LAKE HURON","DISTRICT OF COLUMBIA","RHODE ISLAND","LAKE MICHIGAN","LAKE SUPERIOR","LAKE ST CLAIR","LAKE ERIE","LAKE ONTARIO","E PACIFIC","GULF OF ALASKA"] |
30000 | ["TEXAS","NEBRASKA","IOWA","MINNESOTA","WISCONSIN"] |
4000000 | ["CALIFORNIA","KENTUCKY","NORTH DAKOTA","WISCONSIN","VIRGINIA"] |
3000000 | ["CALIFORNIA","ILLINOIS","MISSOURI","SOUTH CAROLINA","NORTH CAROLINA","MISSISSIPPI","NORTH DAKOTA","OHIO"] |
14000000 | ["CALIFORNIA","NORTH DAKOTA"] |
400000 | ["CALIFORNIA","MISSOURI","MISSISSIPPI","NEBRASKA","WISCONSIN","NORTH DAKOTA"] |
50000 | ["CALIFORNIA","GEORGIA","NEBRASKA","TEXAS","WEST VIRGINIA","KANSAS","MISSOURI","MISSISSIPPI","NEW MEXICO","IOWA","NORTH DAKOTA","OHIO","WISCONSIN","ILLINOIS","MINNESOTA","KENTUCKY"] |
18000 | ["WASHINGTON","WISCONSIN"] |
107900000 | ["CALIFORNIA"] |
28900000 | ["CALIFORNIA"] |
从数组列设置
以下示例显示了数组中的元素集。
datatable (Val: int, Arr1: dynamic)
[
1, dynamic(['A1', 'A2', 'A3']),
5, dynamic(['A2', 'C1']),
7, dynamic(['C2', 'A3']),
5, dynamic(['C2', 'A1'])
]
| summarize Val_set=make_set(Val), Arr1_set=make_set(Arr1)
Val_set | Arr1_set |
---|---|
[1,5,7] | ["A1","A2","A3","C1","C2"] |
相关内容
- 将
mv-expand
运算符用于相反的函数。 make_set_if
运算符与make_set
相似,只是它也接受谓词。