Skip to content

State the name another engine calls an aggregate by - #196

Merged
estebanzimanyi merged 1 commit into
MobilityDB:masterfrom
estebanzimanyi:catalog/aggregate-alt-sql-names
Oct 16, 2026
Merged

estebanzimanyi merged 1 commit into
MobilityDB:masterfrom
estebanzimanyi:catalog/aggregate-alt-sql-names

Conversation

@estebanzimanyi

Copy link
Copy Markdown
Member

An aggregate whose PostgreSQL name a function also holds cannot take that
name in DuckDB, Spark or Flink, which hold one function per name: those
engines call tAnd the aggregate tAndAgg. MobilityDB states that name where
it states every other engine's name, in @altsqlfn, on the transition
wrapper of the aggregate beside its @sqlaggfn, a transition serving one
aggregate:

@sqlfn tAndTransition()
@sqlaggfn tAnd()
@altsqlfn tAndAgg()

There @altsqlfn names the aggregate, never the transition: wrapper_names
leaves out a wrapper stating @sqlaggfn, so no transition signature takes
an altSqlName, and attach_aggregate_alt_sql_names, run after
attach_aggregates, pairs the tag with the @sqlaggfn names by position and
sets altSqlName on every entry of the aggregates section of that
aggregate. A wrapper whose two lists differ in length, or an aggregate two
wrappers name differently, stops the catalog, as an unresolved function
alternative does.

Witness: over the MobilityDB branch sql/aggregates-keep-their-names, whose
transition wrappers state @altsqlfn (Tbool_tand_transfn: tAndAgg), master's
parser states an alternative name on 1018 function signatures against 864
over MobilityDB master: the 154 transition signatures take the aggregate's
name as their own, and no aggregate entry takes it.

Why: one tag and one field carry every name an engine takes in place of a
PostgreSQL one, so the bindings read altSqlName for an aggregate as they
do for a function, and need no rule of their own to append Agg.

Measured: over that branch the catalog states altSqlName on 154 aggregate
entries, the CREATE AGGREGATE count of the eleven aggregates whose name a
function also holds, and on 864 function signatures, the count master's
parser and this one both read over MobilityDB master 439dc9fbe3 (0
aggregate entries there, which carries no such tag); the test suite runs
558 tests, OK, the two new ones included.

An aggregate whose PostgreSQL name a function also holds cannot take that
name in DuckDB, Spark or Flink, which hold one function per name: those
engines call tAnd the aggregate tAndAgg. MobilityDB states that name where
it states every other engine's name, in @altsqlfn, on the transition
wrapper of the aggregate beside its @sqlaggfn, a transition serving one
aggregate:

  @sqlfn tAndTransition()
  @sqlaggfn tAnd()
  @altsqlfn tAndAgg()

There @altsqlfn names the aggregate, never the transition: wrapper_names
leaves out a wrapper stating @sqlaggfn, so no transition signature takes
an altSqlName, and attach_aggregate_alt_sql_names, run after
attach_aggregates, pairs the tag with the @sqlaggfn names by position and
sets altSqlName on every entry of the aggregates section of that
aggregate. A wrapper whose two lists differ in length, or an aggregate two
wrappers name differently, stops the catalog, as an unresolved function
alternative does.

Witness: over the MobilityDB branch sql/aggregates-keep-their-names, whose
transition wrappers state @altsqlfn (Tbool_tand_transfn: tAndAgg), master's
parser states an alternative name on 1018 function signatures against 864
over MobilityDB master: the 154 transition signatures take the aggregate's
name as their own, and no aggregate entry takes it.

Why: one tag and one field carry every name an engine takes in place of a
PostgreSQL one, so the bindings read altSqlName for an aggregate as they
do for a function, and need no rule of their own to append Agg.

Measured: over that branch the catalog states altSqlName on 154 aggregate
entries, the CREATE AGGREGATE count of the eleven aggregates whose name a
function also holds, and on 864 function signatures, the count master's
parser and this one both read over MobilityDB master 439dc9fbe3 (0
aggregate entries there, which carries no such tag); the test suite runs
558 tests, OK, the two new ones included.
@estebanzimanyi
estebanzimanyi merged commit bb78d0a into MobilityDB:master Oct 16, 2026
3 checks passed
@estebanzimanyi
estebanzimanyi deleted the catalog/aggregate-alt-sql-names branch October 16, 2026 21:37
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