Continuous query drops the first measurement items

#1

I have the following CQ:

    CREATE CONTINUOUS QUERY MyContinuousQuery ON MyDatabase
    RESAMPLE EVERY 30s FOR 120s
    BEGIN
        SELECT
            sum("non_negative_difference")
        INTO
            MyDatabase2..:MEASUREMENT
        FROM (
            SELECT
                non_negative_difference(sum("count"))
            FROM
                /.*/
            GROUP BY
                subtask_index,
                time(30s)
            )
        GROUP BY
            time(30s)
    END

Each time a new measurement is created in MyDatabase, after a while a corresponding measurement is created by the CQ in MyDatabase2. However, the first entry in the measurement in MyDatabase seems to be not taken into account in the corresponding measurement in MyDatabase2.

Original measurement:

"values": [
    ["2017-10-09T09:20:04.741Z", 4],
    ["2017-10-09T09:20:34.796Z", 4],
    ["2017-10-09T09:21:04.834Z", 6],
    ["2017-10-09T09:21:34.849Z", 7]
]

CQ output:

"values": [
    ["2017-10-09T09:20:30Z", 0],
    ["2017-10-09T09:21:00Z", 2],
    ["2017-10-09T09:21:30Z", 1]
]

I expected to have ["2017-10-09T09:20:00Z", 4] in CQ output. Do I misuse or misunderstand how continuous query works? How can I achieve it?