This function is used to execute the M4 aggregation query using the MAC (merging all chunks) approach.
Name: M4
Input Series: Only supports a single input sequence, the type is INT32 / INT64 / FLOAT / DOUBLE
Parameters:
tqs: The start time (included) of the query time range.tqe: The end time (excluded) of the query time range.w: The number of time spans in the M4 aggregation.Output Series: The first, last, bottom, and top points in each time span [tqs+(tqe-tqs)/w*(i-1),tqs+(tqe-tqs)/w*i), i=1,...,w.
Note:
research/M4-visualization right now.time>=tqs and time<tqe in the where clause.Input series:
+-----------------------------+------------------+ | Time|root.vehicle.d0.s0| +-----------------------------+------------------+ |1970-01-01T08:00:00.001+08:00| 5.0| |1970-01-01T08:00:00.002+08:00| 15.0| |1970-01-01T08:00:00.005+08:00| 10.0| |1970-01-01T08:00:00.008+08:00| 8.0| |1970-01-01T08:00:00.010+08:00| 20.0| |1970-01-01T08:00:00.020+08:00| 20.0| |1970-01-01T08:00:00.025+08:00| 8.0| |1970-01-01T08:00:00.027+08:00| 20.0| |1970-01-01T08:00:00.030+08:00| 40.0| |1970-01-01T08:00:00.033+08:00| 9.0| |1970-01-01T08:00:00.035+08:00| 10.0| |1970-01-01T08:00:00.040+08:00| 20.0| |1970-01-01T08:00:00.045+08:00| 30.0| |1970-01-01T08:00:00.052+08:00| 8.0| |1970-01-01T08:00:00.054+08:00| 18.0| |1970-01-01T08:00:00.120+08:00| 8.0| +-----------------------------+------------------+
SQL for query:
select M4(s0,'tqs'='0','tqe'='100','w'='4') from root.vehicle.d0 where time>=0 and time<100
Output:
+-----------------------------+----------------------------------------------------------------------------------+ | Time| M4(root.vehicle.d0.s0, "tqs"="0", "tqe"="100", "w"="4")| +-----------------------------+----------------------------------------------------------------------------------+ |1970-01-01T08:00:00.000+08:00| FirstPoint=(1,5.0), LastPoint=(20,20.0), BottomPoint=(1,5.0), TopPoint=(10,20.0)| |1970-01-01T08:00:00.025+08:00|FirstPoint=(25,8.0), LastPoint=(45,30.0), BottomPoint=(25,8.0), TopPoint=(30,40.0)| |1970-01-01T08:00:00.050+08:00|FirstPoint=(52,8.0), LastPoint=(54,18.0), BottomPoint=(52,8.0), TopPoint=(54,18.0)| |1970-01-01T08:00:00.075+08:00| empty| +-----------------------------+----------------------------------------------------------------------------------+