Skip to content

Generate aggregate identity from the @csqlaggfn tag#55

Merged
estebanzimanyi merged 1 commit into
MobilityDB:masterfrom
estebanzimanyi:feat/csqlaggfn-catalog-generation
Jul 15, 2026
Merged

Generate aggregate identity from the @csqlaggfn tag#55
estebanzimanyi merged 1 commit into
MobilityDB:masterfrom
estebanzimanyi:feat/csqlaggfn-catalog-generation

Conversation

@estebanzimanyi

Copy link
Copy Markdown
Member

The catalog resolves a function's SQL name from @sqlfn/@csqlfn, but an aggregate member (a transition/combine/final function) has no way to record which SQL aggregate it belongs to. Its SQL-facing name collides with the identically named binary set/span union function, so a binding cannot tell int_union_transfn (a setUnion member) apart from the setUnion(int) scalar function and has to guess the aggregate structure from name suffixes.

This reads the @csqlaggfn tag from meos/src and attaches a new sqlAgg field naming the SQL aggregate role(s) each member implements:

  • int_union_transfn["setUnionTransition"]
  • set_union_finalfn["setUnionFinal"]
  • span_union_transfn["spanUnionTransition"]
  • spanset_union_finalfn["spanUnionFinal", "spansetUnionFinal"] (one member shared by two aggregates)

The tag is one hop: the #Name() references are the SQL aggregate-role names directly, with no wrapper indirection to resolve, so the extractor mirrors _meos_to_mdb minus the second _mdb_to_sql hop. Names are recorded verbatim — a faithful reader, no derivation.

Depends on the corresponding @csqlaggfn source tags in MobilityDB (MobilityDB/MobilityDB#1411); the field attaches once those tags are present in the scanned source.

Read @csqlaggfn from meos/src so each transition/combine/final function
records the SQL aggregate role it implements in a new `sqlAgg` catalog
field. This gives an aggregate member its own identity (setUnionTransition,
spanUnionFinal) distinct from the identically named binary set/span union
function, so a binding can reconstruct the standard PostgreSQL aggregate
model rather than guess from name suffixes.

The tag is one hop: the #Name() references are the SQL aggregate-role
names directly, with no wrapper indirection to resolve. A member shared by
two aggregates (spanset_union_finalfn) carries a list of names, recorded
verbatim.
@estebanzimanyi estebanzimanyi merged commit 65ced30 into MobilityDB:master Jul 15, 2026
2 checks passed
@estebanzimanyi estebanzimanyi deleted the feat/csqlaggfn-catalog-generation branch July 15, 2026 18:51
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