Skip to content

Run the aggregates of the catalog over a base value on both typed SQL surfaces - #176

Merged
estebanzimanyi merged 1 commit into
MobilityDB:mainfrom
estebanzimanyi:codegen/base-value-aggregates
Oct 11, 2026
Merged

estebanzimanyi merged 1 commit into
MobilityDB:mainfrom
estebanzimanyi:codegen/base-value-aggregates

Conversation

@estebanzimanyi

Copy link
Copy Markdown
Member

setUnion over an integer, a bigint, a float, a text, a date and a timestamp, extent over an
integer, a bigint, a float, a date and a timestamp, and tCount over a timestamp fold a base value
into a set, a span or a temporal integer, each role a public MEOS function: int_union_transfn,
int_extent_transfn, timestamptz_tcount_transfn and their siblings, with the combine, final,
serialize and deserialize of the same aggregate over the typed values. _catalog_aggregates of
tools/codegen_jvm.py carries an aggregate whose first argument is a base value, read into the
class the scalars of the surface take it as (Integer, Long, Double, String, LocalDate, Instant)
and passed to the transition as they pass it, and _spark_encoder gives Spark the encoder of each
of those classes. Flink chooses the accumulate of an overload from the class of the argument, as
for the typed values.

Witness: with the generator of JMEOS main e8c65dc both surfaces leave the 12 out as "argument
or result of no value type", and MobilitySpark's test fails with "aggregate
setUnionAgg(int) does not exist".

Measured over MobilityDB b2dcdf7d84 and MEOS-API 9b337a00fe: both surfaces register 22 aggregates
of 260 overloads against 22 of 248, the 12 added and nothing else changing; every aggregate of the
catalog is carried. With this generator MobilitySpark passes 46 tests, 18 of them in
GeneratedSqlSurfaceTest, and MobilityFlink 35 binding and 12 benchmark tests, each surface
checking the 12 against MobilityDB's answers over the same values, with 0 warnings.

Why: a set, a span or a count over the integers, dates or timestamps of a table answers on Spark
and Flink as it does in PostgreSQL.

… surfaces

setUnion over an integer, a bigint, a float, a text, a date and a timestamp, extent over an
integer, a bigint, a float, a date and a timestamp, and tCount over a timestamp fold a base value
into a set, a span or a temporal integer, each role a public MEOS function: int_union_transfn,
int_extent_transfn, timestamptz_tcount_transfn and their siblings, with the combine, final,
serialize and deserialize of the same aggregate over the typed values. _catalog_aggregates of
tools/codegen_jvm.py carries an aggregate whose first argument is a base value, read into the
class the scalars of the surface take it as (Integer, Long, Double, String, LocalDate, Instant)
and passed to the transition as they pass it, and _spark_encoder gives Spark the encoder of each
of those classes. Flink chooses the accumulate of an overload from the class of the argument, as
for the typed values.

Witness: with the generator of JMEOS main e8c65dc both surfaces leave the 12 out as "argument
<type> or result <type> of no value type", and MobilitySpark's test fails with "aggregate
setUnionAgg(int) does not exist".

Measured over MobilityDB b2dcdf7d84 and MEOS-API 9b337a00fe: both surfaces register 22 aggregates
of 260 overloads against 22 of 248, the 12 added and nothing else changing; every aggregate of the
catalog is carried. With this generator MobilitySpark passes 46 tests, 18 of them in
GeneratedSqlSurfaceTest, and MobilityFlink 35 binding and 12 benchmark tests, each surface
checking the 12 against MobilityDB's answers over the same values, with 0 warnings.

Why: a set, a span or a count over the integers, dates or timestamps of a table answers on Spark
and Flink as it does in PostgreSQL.
@estebanzimanyi
estebanzimanyi merged commit 08f0485 into MobilityDB:main Oct 11, 2026
2 checks passed
@estebanzimanyi
estebanzimanyi deleted the codegen/base-value-aggregates branch October 11, 2026 22:15
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