Skip to content

Read the class of an aggregate off the SQL type of its values - #74

Merged
estebanzimanyi merged 1 commit into
MobilityDB:mainfrom
estebanzimanyi:feat/aggregate-overloads
Nov 20, 2026
Merged

estebanzimanyi merged 1 commit into
MobilityDB:mainfrom
estebanzimanyi:feat/aggregate-overloads

Conversation

@estebanzimanyi

Copy link
Copy Markdown
Member

An aggregate several transitions serve under one name, one per type of its values, as tMinAgg is tint_tmin_transfn over tint and tfloat_tmin_transfn over tfloat, is a static method of each value's class. #aggregate_class of tools/objectgen.py reads that class off the catalog as #aggregateClass of MEOS.js's codegen/ObjectGenerator.ts does: the leaf of the lattice whose prefix is the SQL type of the aggregate's values (args[0] of the aggregate, tint naming TInt), and otherwise the class of the C type the transition takes the values as. Each method keeps the aggregate's one name and takes the values as its class's own: TInt.TMinAgg(TInt[] values) and TFloat.TSum(TFloat[] values). A struct argument passed by value, the interval of the window aggregates and of appendInstantAgg, is laid out once for every call of the transition, as #call_body lays one out for its call, so TInt.WMin(TInt[] values, Interval interv) and the other window aggregates are methods too; no aggregate is left in GAP-LEDGER.md. MEOS.NET.Tests/AggregateOverloadTests.cs sums two temporal floats and takes the minimum of a temporal integer.

Why: an aggregate whose transitions all take a Temporal had no method, since the class of that C type is Temporal for every one of them, and an aggregate whose transition takes an interval had none either.

Measured: over the catalog of MobilityDB master d2a7ca45ca, dotnet build reports 0 warnings and 0 errors, and dotnet test passes 123 of 123 with none skipped.

An aggregate several transitions serve under one name, one per type of its values, as tMinAgg is tint_tmin_transfn over tint and tfloat_tmin_transfn over tfloat, is a static method of each value's class. #aggregate_class of tools/objectgen.py reads that class off the catalog as #aggregateClass of MEOS.js's codegen/ObjectGenerator.ts does: the leaf of the lattice whose prefix is the SQL type of the aggregate's values (args[0] of the aggregate, tint naming TInt), and otherwise the class of the C type the transition takes the values as. Each method keeps the aggregate's one name and takes the values as its class's own: TInt.TMinAgg(TInt[] values) and TFloat.TSum(TFloat[] values). A struct argument passed by value, the interval of the window aggregates and of appendInstantAgg, is laid out once for every call of the transition, as #call_body lays one out for its call, so TInt.WMin(TInt[] values, Interval interv) and the other window aggregates are methods too; no aggregate is left in GAP-LEDGER.md. MEOS.NET.Tests/AggregateOverloadTests.cs sums two temporal floats and takes the minimum of a temporal integer.

Why: an aggregate whose transitions all take a Temporal had no method, since the class of that C type is Temporal for every one of them, and an aggregate whose transition takes an interval had none either.

Measured: over the catalog of MobilityDB master d2a7ca45ca, dotnet build reports 0 warnings and 0 errors, and dotnet test passes 123 of 123 with none skipped.
@estebanzimanyi
estebanzimanyi merged commit 66cfb9d into MobilityDB:main Nov 20, 2026
1 check passed
@estebanzimanyi
estebanzimanyi deleted the feat/aggregate-overloads branch November 20, 2026 07:08
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