Skip to content

Run the append aggregates of the catalog on both typed SQL surfaces - #172

Merged
estebanzimanyi merged 1 commit into
MobilityDB:mainfrom
estebanzimanyi:feat/append-aggregates
Oct 11, 2026
Merged

estebanzimanyi merged 1 commit into
MobilityDB:mainfrom
estebanzimanyi:feat/append-aggregates

Conversation

@estebanzimanyi

Copy link
Copy Markdown
Member

appendInstantAgg and appendSequenceAgg state no combine: each is the constructor of a temporal
value fed one row at a time, appendInstantAgg building a sequence from instants as
tsequence_make builds one from an array, and appendSequenceAgg a sequence set from sequences as
tsequenceset_make does. Their transitions accept a value only after those already folded in
time, as the constructors accept an array only in that order, so time is the one order that
answers. Neither Spark nor Flink hands the rows of a group in an order, and each joins partial
aggregates, so for an aggregate stating no combine both surfaces gather the rows of a group, a
partial joining another by taking its rows, and fold them at the end ordered by the start
timestamp of their first argument, which temporal_start_timestamptz answers: the answer
PostgreSQL gives over the same rows ordered by time, and the error it raises over rows no order
accepts.

The transition of an aggregate takes the further arguments as the signature of the transition
the aggregate names reads them, its boundArgs and sqlArgParams, so appendInstantAgg(tint) passes
the interpolation of its type, a distance of -1.0 and no interval, and appendInstantAgg(tbool,
text, interval) a distance of -1.0. A text and a float are arguments both surfaces encode, beside
the interval of the window aggregates, and Spark resolves an aggregate as it resolves a function,
an exact fit first and then one widening a number, so the distance 1.5, a decimal, reaches the
float. A final taking its state const keeps it, as temporal_append_finalfn answers a compact
copy, and the state is released after its final; every other final consumes its state. The Flink
MeosValue is Serializable, as the Spark one is, so the accumulator of an aggregate gathering rows
writes them.

Witness: with the generator of JMEOS main ba1e61c neither surface registers appendInstantAgg or
appendSequenceAgg, the 77 overloads of their catalog names left out as stating no combine.

Measured over MobilityDB 3a8e6dba09 and the catalog of MEOS-API 4baf11705c: each surface
registers 22 aggregates of 248 overloads, against 20 of 171 with the generator of main, the 77
of appendInstantAgg and appendSequenceAgg among them, and leaves out no aggregate as stating no
combine. Every class of the other 20 aggregates differs only by the two arguments the roles take,
false and null.

Why: a trajectory built from its instants or its pieces answers on Spark and Flink as it does in
PostgreSQL, whatever order the engine hands the rows in.

appendInstantAgg and appendSequenceAgg state no combine: each is the constructor of a temporal
value fed one row at a time, appendInstantAgg building a sequence from instants as
tsequence_make builds one from an array, and appendSequenceAgg a sequence set from sequences as
tsequenceset_make does. Their transitions accept a value only after those already folded in
time, as the constructors accept an array only in that order, so time is the one order that
answers. Neither Spark nor Flink hands the rows of a group in an order, and each joins partial
aggregates, so for an aggregate stating no combine both surfaces gather the rows of a group, a
partial joining another by taking its rows, and fold them at the end ordered by the start
timestamp of their first argument, which temporal_start_timestamptz answers: the answer
PostgreSQL gives over the same rows ordered by time, and the error it raises over rows no order
accepts.

The transition of an aggregate takes the further arguments as the signature of the transition
the aggregate names reads them, its boundArgs and sqlArgParams, so appendInstantAgg(tint) passes
the interpolation of its type, a distance of -1.0 and no interval, and appendInstantAgg(tbool,
text, interval) a distance of -1.0. A text and a float are arguments both surfaces encode, beside
the interval of the window aggregates, and Spark resolves an aggregate as it resolves a function,
an exact fit first and then one widening a number, so the distance 1.5, a decimal, reaches the
float. A final taking its state const keeps it, as temporal_append_finalfn answers a compact
copy, and the state is released after its final; every other final consumes its state. The Flink
MeosValue is Serializable, as the Spark one is, so the accumulator of an aggregate gathering rows
writes them.

Witness: with the generator of JMEOS main ba1e61c neither surface registers appendInstantAgg or
appendSequenceAgg, the 77 overloads of their catalog names left out as stating no combine.

Measured over MobilityDB 3a8e6dba09 and the catalog of MEOS-API 4baf11705c: each surface
registers 22 aggregates of 248 overloads, against 20 of 171 with the generator of main, the 77
of appendInstantAgg and appendSequenceAgg among them, and leaves out no aggregate as stating no
combine. Every class of the other 20 aggregates differs only by the two arguments the roles take,
false and null.

Why: a trajectory built from its instants or its pieces answers on Spark and Flink as it does in
PostgreSQL, whatever order the engine hands the rows in.
estebanzimanyi added a commit to estebanzimanyi/JMEOS that referenced this pull request Oct 11, 2026
The tests of jmeos-core run concurrently, classes and methods alike (junit-platform.properties),
and the binding holds only the latest error handler MEOS receives, in the static field the wrapper
of meos_initialize_error_handler fills. ErrorHandlerRegistrationTest registers a handler it keeps
no reference to and checks that a collection leaves it reachable, so a handler registered
meanwhile, by the other test of the class or by a class such as STBoxTest, replaces the one it
checks and leaves that one to the collector. The class is @isolated, as MeosInitializeHandlerTest
is, so nothing registers a handler while it runs.

Witness: the fork run 38103656194 of JMEOS MobilityDB#172 at 89fd5ee fails
ErrorHandlerRegistrationTest.unreferencedHandlerStaysReachable with "the registered handler was
collected while MEOS holds it", while the upstream run 38103672322 of the same commit passes it.

Measured over MobilityDB 3a8e6dba09 and the catalog of MEOS-API 4baf11705c: three runs of the
jmeos-core suite pass 1804 tests each, the two of ErrorHandlerRegistrationTest among them.

Why: a test of the binding's handler answers for the binding, not for the order in which the
concurrent tests register theirs.
@estebanzimanyi
estebanzimanyi merged commit 845e588 into MobilityDB:main Oct 11, 2026
2 checks passed
estebanzimanyi added a commit that referenced this pull request Oct 11, 2026
The tests of jmeos-core run concurrently, classes and methods alike (junit-platform.properties),
and the binding holds only the latest error handler MEOS receives, in the static field the wrapper
of meos_initialize_error_handler fills. ErrorHandlerRegistrationTest registers a handler it keeps
no reference to and checks that a collection leaves it reachable, so a handler registered
meanwhile, by the other test of the class or by a class such as STBoxTest, replaces the one it
checks and leaves that one to the collector. The class is @isolated, as MeosInitializeHandlerTest
is, so nothing registers a handler while it runs.

Witness: the fork run 38103656194 of JMEOS #172 at 89fd5ee fails
ErrorHandlerRegistrationTest.unreferencedHandlerStaysReachable with "the registered handler was
collected while MEOS holds it", while the upstream run 38103672322 of the same commit passes it.

Measured over MobilityDB 3a8e6dba09 and the catalog of MEOS-API 4baf11705c: three runs of the
jmeos-core suite pass 1804 tests each, the two of ErrorHandlerRegistrationTest among them.

Why: a test of the binding's handler answers for the binding, not for the order in which the
concurrent tests register theirs.
@estebanzimanyi
estebanzimanyi deleted the feat/append-aggregates branch October 11, 2026 08:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant