# MvAvg
# Usage
This function is used to calculate moving average of input series.
Name: MVAVG
Input Series: Only support a single input series. The type is INT32 / INT64 / FLOAT / DOUBLE.
window
: Length of the moving window. Default value is 10.
Output Series: Output a single series. The type is DOUBLE.
# Examples
# Batch computing
Input series:
+-----------------------------+------------+
| Time|root.test.s1|
+-----------------------------+------------+
|1970-01-01T08:00:00.100+08:00| 0.0|
|1970-01-01T08:00:00.200+08:00| 0.0|
|1970-01-01T08:00:00.300+08:00| 1.0|
|1970-01-01T08:00:00.400+08:00| -1.0|
|1970-01-01T08:00:00.500+08:00| 0.0|
|1970-01-01T08:00:00.600+08:00| 0.0|
|1970-01-01T08:00:00.700+08:00| -2.0|
|1970-01-01T08:00:00.800+08:00| 2.0|
|1970-01-01T08:00:00.900+08:00| 0.0|
|1970-01-01T08:00:01.000+08:00| 0.0|
|1970-01-01T08:00:01.100+08:00| 1.0|
|1970-01-01T08:00:01.200+08:00| -1.0|
|1970-01-01T08:00:01.300+08:00| -1.0|
|1970-01-01T08:00:01.400+08:00| 1.0|
|1970-01-01T08:00:01.500+08:00| 0.0|
|1970-01-01T08:00:01.600+08:00| 0.0|
|1970-01-01T08:00:01.700+08:00| 10.0|
|1970-01-01T08:00:01.800+08:00| 2.0|
|1970-01-01T08:00:01.900+08:00| -2.0|
|1970-01-01T08:00:02.000+08:00| 0.0|
+-----------------------------+------------+
SQL for query:
select mvavg(s1, "window"="3") from root.test
Output series:
+-----------------------------+---------------------------------+
| Time|mvavg(root.test.s1, "window"="3")|
+-----------------------------+---------------------------------+
|1970-01-01T08:00:00.300+08:00| 0.3333333333333333|
|1970-01-01T08:00:00.400+08:00| 0.0|
|1970-01-01T08:00:00.500+08:00| -0.3333333333333333|
|1970-01-01T08:00:00.600+08:00| 0.0|
|1970-01-01T08:00:00.700+08:00| -0.6666666666666666|
|1970-01-01T08:00:00.800+08:00| 0.0|
|1970-01-01T08:00:00.900+08:00| 0.6666666666666666|
|1970-01-01T08:00:01.000+08:00| 0.0|
|1970-01-01T08:00:01.100+08:00| 0.3333333333333333|
|1970-01-01T08:00:01.200+08:00| 0.0|
|1970-01-01T08:00:01.300+08:00| -0.6666666666666666|
|1970-01-01T08:00:01.400+08:00| 0.0|
|1970-01-01T08:00:01.500+08:00| 0.3333333333333333|
|1970-01-01T08:00:01.600+08:00| 0.0|
|1970-01-01T08:00:01.700+08:00| 3.3333333333333335|
|1970-01-01T08:00:01.800+08:00| 4.0|
|1970-01-01T08:00:01.900+08:00| 0.0|
|1970-01-01T08:00:02.000+08:00| -0.6666666666666666|
+-----------------------------+---------------------------------+