在 Kusto 中使用联合和循环运算符将多个表合并为一个表
Unite multiple tables into a single one using union and a loop operator in Kusto
我对 Azure 数据资源管理器 (Kusto) 查询还很陌生。我有一个 stored function,它以 dateTime 作为参数,围绕该 dateTime 和 return 查询数据 table.
MyStoredFunction(timestamp:datetime){
// some query
}
由于一些限制,我必须多次 运行 这个函数,连续的日期时间,每个日期时间间隔一小时,然后使用 [=14] 将结果合并为一个 table =]运算符。
ResultTable
| union MyStoredFunction(now(-1h))
, MyStoredFunction(now(-2h))
, MyStoredFunction(now(-3h))
, MyStoredFunction(now(-4h))
, MyStoredFunction(now(-5h))
, MyStoredFunction(now(-6h))
| Project column1, column2, column3
| Summarize …
有没有办法使用 range 运算符或任何其他 Kusto 查询运算符来美化上述难看的查询?
类似这样(以下查询无效,仅供说明):
range TIMESTAMP from now(-7h) to now() step 1h
| ResultTable = union ResultTable, MyStoredFunction(TIMESTAMP)
非常感谢任何帮助。
目前这是不可能的。
union 运算符支持通配符,但仅适用于实际表而不是函数执行的结果。
我对 Azure 数据资源管理器 (Kusto) 查询还很陌生。我有一个 stored function,它以 dateTime 作为参数,围绕该 dateTime 和 return 查询数据 table.
MyStoredFunction(timestamp:datetime){
// some query
}
由于一些限制,我必须多次 运行 这个函数,连续的日期时间,每个日期时间间隔一小时,然后使用 [=14] 将结果合并为一个 table =]运算符。
ResultTable
| union MyStoredFunction(now(-1h))
, MyStoredFunction(now(-2h))
, MyStoredFunction(now(-3h))
, MyStoredFunction(now(-4h))
, MyStoredFunction(now(-5h))
, MyStoredFunction(now(-6h))
| Project column1, column2, column3
| Summarize …
有没有办法使用 range 运算符或任何其他 Kusto 查询运算符来美化上述难看的查询?
类似这样(以下查询无效,仅供说明):
range TIMESTAMP from now(-7h) to now() step 1h
| ResultTable = union ResultTable, MyStoredFunction(TIMESTAMP)
非常感谢任何帮助。
目前这是不可能的。
union 运算符支持通配符,但仅适用于实际表而不是函数执行的结果。