You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Kusto函数空参数处理:参数为Null时返回所有行,否则过滤

Kusto函数实现:根据参数是否为空返回对应结果

可以这样修改函数,利用Kusto的isnull()函数判断参数是否为null,结合逻辑或(or)实现需求:

.create-or-alter function fnGetSecurityGroups(groupType:string) {
    SecurityGroups 
    | where isnull(groupType) or GroupType =~ groupType
}

逻辑说明:

  • 当传入的groupType参数为null时,isnull(groupType)返回true,整个where条件成立,返回SecurityGroups表的所有行
  • 当groupType参数不为null时,isnull(groupType)返回false,此时会执行后半部分的GroupType =~ groupType,对GroupType列进行不区分大小写的匹配过滤

内容的提问来源于stack exchange,提问作者Vinny

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.10 22:42:01