【问题标题】:Passing date table to range function in Kusto将日期表传递给 Kusto 中的范围函数
【发布时间】:2020-12-15 06:23:32
【问题描述】:

在 Kusto 查询语言中,是否可以将一列日期传递给范围?我正在尝试沿这些日期呈现时间线图表映射 table4 值。 todatetime("1598149365") 可以工作,但 table_dates3 不行。或者是否有类似的方法。

TableName
| where Name == "abc"
| project table_dates1, table_dates2, table_dates3, table4
| make-series num=count() default=0 on todatetime(table_dates1) in range(todatetime(table_dates2), todatetime(table_dates3), 1h) by table4
| render timechart

【问题讨论】:

    标签: mysql database date azure-data-explorer kql


    【解决方案1】:

    您应该使用“[from start] [to end] step step”语法而不是旧的 range() 语法。 “from”和“to”是可选的,如果未提供,它们将是每个时间序列的最小/最大时间。所以可能是这样的:

    TableName
    | where Name == "abc"
    | project table_dates1, table_dates2, table_dates3, table4
    | make-series num=count() on todatetime(table_dates1) step 1h by table4
    | render timechart
    

    【讨论】:

    • 谢谢阿迪。它有效,但我希望将输出限制在一个日期范围内,即开始日期和结束日期。
    • | make-series num=count() default=0 on todatetime(table_dates1) in range(todatetime("1598165365"), todatetime(t"1598149365""), 1h) by table4 完全符合我的需要,但我需要将值作为日期表而不是文字日期。第一列在on 中被接受,但不在范围内。有没有办法做到这一点?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-07-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多