bin_auto()bin_auto()

将值向下舍入为固定大小的“bin”,并由查询属性提供对 bin 大小和起点的控制。Rounds values down to a fixed-size "bin", with control over the bin size and starting point provided by a query property.

语法Syntax

bin_auto ( Expression )bin_auto ( Expression )

参数Arguments

  • 表达式:数值类型的标量表达式,指示要舍入的值。Expression: A scalar expression of a numeric type indicating the value to round.

客户端请求属性Client Request Properties

  • query_bin_auto_size:指示每个 bin 大小的数值文本。query_bin_auto_size: A numeric literal indicating the size of each bin.
  • query_bin_auto_at:指示 Expression 的一个值的数值文本,是一个“固定点”(即,bin_auto(fixed_point) == fixed_point 的值 fixed_pointquery_bin_auto_at: A numeric literal indicating one value of Expression which is a "fixed point" (that is, a value fixed_point for which bin_auto(fixed_point) == fixed_point.)

返回Returns

Expression 下 query_bin_auto_at 最接近的倍数已移位,因此 query_bin_auto_at 将被转换为自身。The nearest multiple of query_bin_auto_at below Expression, shifted so that query_bin_auto_at will be translated into itself.

示例Examples

set query_bin_auto_size=1h;
set query_bin_auto_at=datetime(2017-01-01 00:05);
range Timestamp from datetime(2017-01-01 00:05) to datetime(2017-01-01 02:00) step 1m
| summarize count() by bin_auto(Timestamp)
TimestampTimestamp count_count_
2017-01-01 00:05:00.00000002017-01-01 00:05:00.0000000 6060
2017-01-01 01:05:00.00000002017-01-01 01:05:00.0000000 5656