azure - Kusto 查询语言:通过评估表达式设置汇总的列名
问题描述
我再次问了另一个与 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 上的课程,其实 Pluralsight 上有几门优秀的课程(都是免费的):
推荐阅读
- python - 获取最新价格以查看是否获利。用彩色打印
- java - Spring 5 Java 配置设置默认配置文件
- machine-learning - 机器学习从一堆文件中提取文本
- spring-boot - 使用 Spring Boot 2.1.5、Spring Cloud Stream Greenwich.SR1 和 RocketMQ 0.9.0 无法停止 bean 'inputBindingLifecycle'
- c# - aud 如何声明 ROPC 访问令牌中设置的值
- vba - 根据表单上的两个日期值(如果存在)打开报表
- c++ - 将函数应用于犰狳矢量的部分
- apache-flink - 将 Elasticsearch 中的数据读入 Flink 聚合?
- mysql - 使用mysql的一组记录的IF条件
- python - 为 python3 更新 sklearn 不是最新版本