Skip to content

Temporal sampling doesn't respect last instant #690

@Diviloper

Description

@Diviloper

Describe the bug
When sampling a stepwise temporal value where the last sample is right at the last instant and it changes value, this change is not reflected in the sampling.

To Reproduce
Run this example program:

#include <stdio.h>
#include <meos.h>

int main() {
    /* Initialize MEOS */
    meos_initialize();

    Temporal *original = tbool_in("[True@2019-09-01, False@2019-09-02]");
    Temporal *expected = tbool_in("[True@2019-09-01, True@2019-09-01 12:00:00, False@2019-09-02]");

    Interval *interval = pg_interval_in("12 hours", -1);
    TimestampTz tz = pg_timestamptz_in("2019-09-01", -1);


    Temporal *sampled = temporal_tsample(original, interval, tz, STEP);
    printf("Sampled Temporal: %s\n", tbool_out(sampled));       // [t@2019-09-01 00:00:00+02, t@2019-09-02 00:00:00+02]
    printf("Expected Temporal: %s\n", tbool_out(expected));     // [t@2019-09-01 00:00:00+02, f@2019-09-02 00:00:00+02]


    /* Finalize MEOS */
    meos_finalize();

    /* Return */
    return EXIT_SUCCESS;
}

Expected behavior
The last instant of the sampling result is false (i.e. [t@2019-09-01 00:00:00+02, f@2019-09-02 00:00:00+02]), but it is true (i.e. [t@2019-09-01 00:00:00+02, t@2019-09-02 00:00:00+02]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions