我再次问另一个与 Kusto 相关的问题(我真的希望某个地方有一个关于此问题的完整视频教程)。
我有一个 summarize
语句,它为 y 轴生成两列,为 x 轴生成一列。
现在我想重新标记 x 轴的列以显示一个字符串,该字符串也是我从数据库中获取的,并且已使用 let
放入变量中。
这基本上看起来像这样:
let android_col = strcat("Android: ", toscalar(customEvents
| where application_Version contains secondLatestVersionAndroid));
let iOS_col = strcat("iOS: ", toscalar(customEvents
| where application_Version contains secondLatestVersionIOS));
... some Kusto magic ...
| summarize
Android = 100 - (round((countif(hasUnhandledErrorAndroid == 1 ) * 100.0 ) / countif(isAndroid == 1), 2)),
iOS = 100 - (round((countif(hasUnhandledErroriOS == 1) * 100.0 ) / countif(isIOS == 1), 2))
by Time
|render timechart with (ytitle="crashfree users in %", xtitle="date", legend=visible )
现在我想要显示的不是 Android 和 iOS 的摘要,而是 android_col 和 iOS_col 的值。
这可能吗?
最诚挚的问候 特立独行
最佳答案
一般情况下,建议预定义列名,否则各种功能无法使用。例如,IntelliSense 不会知道列的名称,因为它们仅在运行时确定。此外,如果您创建一个返回动态架构的函数,您将无法从其他集群运行此函数。
但是,如果您确实想更改列名称,那么您肯定有办法通过使用各种插件来实现。例如,bag_unpack , pivot以及其他。
至于 Kusto 上的类(class),Pluralsight 上其实有几门优秀的类(class)(都是免费的):
关于azure - Kusto 查询语言 : set column name of summarize by evaluated expression,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64332198/