Skip to content

Take the lifted stream operations from the catalog - #69

Merged
estebanzimanyi merged 1 commit into
masterfrom
gen/math-ops-checked-against-catalog
Sep 2, 2026
Merged

Take the lifted stream operations from the catalog#69
estebanzimanyi merged 1 commit into
masterfrom
gen/math-ops-checked-against-catalog

Conversation

@estebanzimanyi

@estebanzimanyi estebanzimanyi commented Sep 2, 2026

Copy link
Copy Markdown
Member

catalog_gen.go carries a second table, mathOps: the 22 MEOS functions that take
a temporal number and answer one, each with the SQL name it carries on every
engine, the MEOS C symbol behind it, and the C type of its one further
parameter. The generator selects them from the function's own metadata: the
Doxygen group places it among the value transformations, the category
transformation separates it from a conversion and from an accessor, it takes a
Temporal and answers a Temporal, its leading name token names a class that
admits a tfloat, and it takes at most one further parameter that is not itself
a Temporal.

mathops_meos_gen.go is the cgo call for each of them, behind the meos build
tag, and liftInstant dispatches through it. The MEOS C symbol behind an
operation is written by hand nowhere: the catalog names it, the generator emits
the call, and a rename upstream is a compile error rather than a call to a
function that means something else. The one float64 a continuous query carries
fills a further parameter through one conversion per C type: a double directly,
an int truncated, a bool as non-zero, which is what gives the degrees
normalisation flag the false it takes. An operation whose parameter cannot be
filled from that single value, as scaleTime and setInterp cannot, gets no case
and answers the caller as unserved. 19 of the 22 are callable.

Each entry of liftedOps names the SQL function it lifts, and catalog_test.go
holds the two together: the name must be one the catalog states over a temporal
number, it must name exactly one function, and the query supplies the further
parameter exactly when the catalog gives it as a double. Both rules are
exercised against a control: pointing an operation at a name MEOS does not
carry, and claiming an arity the catalog contradicts, each fail with the
sentence naming the disagreement.

What stays declared in the tier is WHICH operations are pointwise, and that is
the one thing about them MEOS does not state. The catalog places derivative,
trend and angularDifference in the same group and the same category as sin and
abs, because all five transform a temporal number's values; only the first
three do it by walking segments, and a stream record is one instant with no
neighbour to read. A test names those three and requires them to stay out of
the lifted set, and to stay in the catalog, so it measures something.

TestMeosTransform measures all fifteen lifted operations against expected
values, so the dispatch is equivalent by measurement rather than by inspection,
and it requires that every lifted operation appear among its cases: an
operation nobody measures could call the wrong symbol and still pass. Removing
one from the cases fails with the sentence naming it.

The build job regenerates both files and refuses a difference in either.

catalog_gen.go carries a second table, mathOps: the 22 MEOS functions that take
a temporal number and answer one, each with the SQL name it carries on every
engine, the MEOS C symbol behind it, and the C type of its one further
parameter. The generator selects them from the function's own metadata: the
Doxygen group places it among the value transformations, the category
transformation separates it from a conversion and from an accessor, it takes a
Temporal and answers a Temporal, its leading name token names a class that
admits a tfloat, and it takes at most one further parameter that is not itself
a Temporal.

mathops_meos_gen.go is the cgo call for each of them, behind the meos build
tag, and liftInstant dispatches through it. The MEOS C symbol behind an
operation is written by hand nowhere: the catalog names it, the generator emits
the call, and a rename upstream is a compile error rather than a call to a
function that means something else. The one float64 a continuous query carries
fills a further parameter through one conversion per C type: a double directly,
an int truncated, a bool as non-zero, which is what gives the degrees
normalisation flag the false it takes. An operation whose parameter cannot be
filled from that single value, as scaleTime and setInterp cannot, gets no case
and answers the caller as unserved. 19 of the 22 are callable.

Each entry of liftedOps names the SQL function it lifts, and catalog_test.go
holds the two together: the name must be one the catalog states over a temporal
number, it must name exactly one function, and the query supplies the further
parameter exactly when the catalog gives it as a double. Both rules are
exercised against a control: pointing an operation at a name MEOS does not
carry, and claiming an arity the catalog contradicts, each fail with the
sentence naming the disagreement.

What stays declared in the tier is WHICH operations are pointwise, and that is
the one thing about them MEOS does not state. The catalog places derivative,
trend and angularDifference in the same group and the same category as sin and
abs, because all five transform a temporal number's values; only the first
three do it by walking segments, and a stream record is one instant with no
neighbour to read. A test names those three and requires them to stay out of
the lifted set, and to stay in the catalog, so it measures something.

TestMeosTransform measures all fifteen lifted operations against expected
values, so the dispatch is equivalent by measurement rather than by inspection,
and it requires that every lifted operation appear among its cases: an
operation nobody measures could call the wrong symbol and still pass. Removing
one from the cases fails with the sentence naming it.

The build job regenerates both files and refuses a difference in either.
@estebanzimanyi
estebanzimanyi force-pushed the gen/math-ops-checked-against-catalog branch from e8e2690 to e6be96c Compare September 2, 2026 21:35
@estebanzimanyi estebanzimanyi changed the title Check the lifted stream operations against the catalog Take the lifted stream operations from the catalog Sep 2, 2026
@estebanzimanyi
estebanzimanyi merged commit db9b4a1 into master Sep 2, 2026
2 checks passed
@estebanzimanyi
estebanzimanyi deleted the gen/math-ops-checked-against-catalog branch September 2, 2026 21:40
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