Take the lifted stream operations from the catalog - #69
Merged
Conversation
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
force-pushed
the
gen/math-ops-checked-against-catalog
branch
from
September 2, 2026 21:35
e8e2690 to
e6be96c
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.