【问题标题】:How to build a new dynamic column based on other columns in Azure Data Explorer KQL如何基于 Azure 数据资源管理器 KQL 中的其他列构建新的动态列
【发布时间】:2021-06-18 17:10:27
【问题描述】:

我有一个包含各种动态列的结果集,并希望将这些动态列投影到一个新的动态列中,这些列作为属性包含在其中。

例子:

我的结果集包含 2 个动态列

"MainSoftware": {
    "Version": "2.10",
    "BuildConfig": 3,
    "SettingsVersion": 1
},
"SecSoftware": {
    "ArticleNumber": "123",
    "Version": "1.0"
}

我想创建以下列作为输出:

"Software": {
  "MainSoftware": {
    "Version": "2.10",
    "BuildConfig": 3,
    "SettingsVersion": 1
  },
  "SecSoftware": {
    "ArticleNumber": "123",
    "Version": "1.0"
  }
}

我尝试使用 make_bag 但这只能用作聚合函数,并且在我的情况下我有一个平面结果集,我只需要基于我已经拥有的列构建一个计算的动态列。

我也尝试使用这样的动态关键字创建列

| extend Software=dynamic({"MainSoftware": MainSoftware, "SecSoftware":SecSoftware})

但这在语法上不正确,因为我似乎只能在表达式中使用常量值。

【问题讨论】:

    标签: azure-data-explorer kql


    【解决方案1】:

    我找到了解决问题的办法。

    pack-function 正是我所需要的。

    | project Software=pack("MainSoftware", MainSoftware, "SecSoftware", SecSoftware)
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-12-27
      • 1970-01-01
      • 2021-02-25
      • 1970-01-01
      相关资源
      最近更新 更多