Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/generated/generated_temporal_udfs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ void RegisterGenerated_meos_h3_edges(ExtensionLoader &loader);
void RegisterGenerated_meos_h3_hierarchy(ExtensionLoader &loader);
void RegisterGenerated_meos_h3_inspection(ExtensionLoader &loader);
void RegisterGenerated_meos_h3_latlng(ExtensionLoader &loader);
void RegisterGenerated_meos_h3_metrics(ExtensionLoader &loader);
void RegisterGenerated_meos_h3_traversal(ExtensionLoader &loader);
void RegisterGenerated_meos_h3_vertex(ExtensionLoader &loader);
void RegisterGenerated_meos_internal_temporal_inout(ExtensionLoader &loader);
Expand Down Expand Up @@ -236,6 +237,7 @@ void RegisterGeneratedTemporalUdfs(ExtensionLoader &loader) {
RegisterGenerated_meos_h3_hierarchy(loader);
RegisterGenerated_meos_h3_inspection(loader);
RegisterGenerated_meos_h3_latlng(loader);
RegisterGenerated_meos_h3_metrics(loader);
RegisterGenerated_meos_h3_traversal(loader);
RegisterGenerated_meos_h3_vertex(loader);
RegisterGenerated_meos_internal_temporal_inout(loader);
Expand Down
850 changes: 431 additions & 419 deletions src/generated/generated_temporal_udfs_0.cpp

Large diffs are not rendered by default.

1,138 changes: 567 additions & 571 deletions src/generated/generated_temporal_udfs_1.cpp

Large diffs are not rendered by default.

1,446 changes: 740 additions & 706 deletions src/generated/generated_temporal_udfs_2.cpp

Large diffs are not rendered by default.

1,778 changes: 922 additions & 856 deletions src/generated/generated_temporal_udfs_3.cpp

Large diffs are not rendered by default.

1,582 changes: 729 additions & 853 deletions src/generated/generated_temporal_udfs_4.cpp

Large diffs are not rendered by default.

1,082 changes: 589 additions & 493 deletions src/generated/generated_temporal_udfs_5.cpp

Large diffs are not rendered by default.

1,769 changes: 950 additions & 819 deletions src/generated/generated_temporal_udfs_6.cpp

Large diffs are not rendered by default.

1,170 changes: 565 additions & 605 deletions src/generated/generated_temporal_udfs_7.cpp

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions src/include/meos_wrapper_simple.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ extern "C" {
// and links against libmeos. (Alphabetical also keeps meos_pose.h before
// meos_rgeo.h, which depends on it.)
#include <meos_cbuffer.h>
#include <meos_cellindex.h>
#include <meos_h3.h>
#include <meos_json.h>
#include <meos_npoint.h>
Expand Down
14 changes: 8 additions & 6 deletions src/temporal/temporal_aggregates.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -919,7 +919,7 @@ static AggregateFunction MakeSetUnionScalarAggregate(const LogicalType &input_ty
// routes SCALAR_FUNCTION_ENTRY and AGGREGATE_FUNCTION_ENTRY into one catalog set, so a
// canonical name is reachable unless a SCALAR already occupies the folded slot — which is
// what the *Agg spelling resolves for merge/tMin/tMax/appendInstant/appendSequence,
// setUnion/spanUnion and minDistance. Where no scalar holds the slot the canonical name
// setUnion/spanUnion, minDistance and tAnd/tOr. Where no scalar holds the slot the canonical name
// MobilityDB publishes is the one a query is written against, so it is registered too.
static void RegisterAggregate(ExtensionLoader &loader, const AggregateFunctionSet &built,
const vector<string> &also = {}) {
Expand All @@ -940,18 +940,20 @@ static void RegisterAggregate(ExtensionLoader &loader, const AggregateFunctionSe
void TemporalAggregates::RegisterAggregateFunctions(ExtensionLoader &loader) {
// Each aggregate registers under the name MobilityDB publishes, plus the
// *Agg spelling this extension already published. A suffix-only name is
// reserved for the slots a scalar holds (tMinAgg/tMaxAgg here).
// reserved for the slots a scalar holds (tAndAgg/tOrAgg/tMinAgg/tMaxAgg here).

// ---- TandAgg / TorAgg on tbool ----
// tAnd and tOr are the scalars MobilityDB publishes from tbool_ops.c, so the
// bare slot belongs to them and the aggregate answers to *Agg alone.
{
AggregateFunctionSet set("tAnd");
AggregateFunctionSet set("TandAgg");
set.AddFunction(MakeTaggAggregate<TandFn>(TemporalTypes::tbool(), TemporalTypes::tbool()));
RegisterAggregate(loader, set, {"TandAgg"});
loader.RegisterFunction(std::move(set));
}
{
AggregateFunctionSet set("tOr");
AggregateFunctionSet set("TorAgg");
set.AddFunction(MakeTaggAggregate<TorFn>(TemporalTypes::tbool(), TemporalTypes::tbool()));
RegisterAggregate(loader, set, {"TorAgg"});
loader.RegisterFunction(std::move(set));
}

// ---- TcountAgg over each temporal type and over time-only inputs → tint ----
Expand Down
19 changes: 17 additions & 2 deletions test/sql/parity/031_aggregates_skiplist.test
Original file line number Diff line number Diff line change
Expand Up @@ -246,15 +246,30 @@ SELECT TcountAgg(v::tint)::VARCHAR FROM (VALUES ('1@2000-01-01'),(NULL),('5@2000
# The canonical MobilityDB name answers for every aggregate no scalar collides
# with. A query written against the MobilityDB manual runs here unchanged; the
# *Agg spelling stays valid beside it.
#
# tAnd and tOr are NOT in that group: MobilityDB publishes them as scalars too
# (tAnd(tbool,tbool) and its boolean-mixed pair), and DuckDB routes scalars and
# aggregates into one catalog set, so the bare slot holds the scalar and the
# aggregate answers to *Agg alone.
# =============================================================================

query I
SELECT tAnd(v::tbool)::VARCHAR FROM (VALUES ('true@2000-01-01'),('true@2000-01-02')) t(v);
SELECT (tAnd('true@2000-01-01'::tbool, 'false@2000-01-01'::tbool))::VARCHAR;
----
f@2000-01-01 00:00:00+01

query I
SELECT (tOr('true@2000-01-01'::tbool, 'false@2000-01-01'::tbool))::VARCHAR;
----
t@2000-01-01 00:00:00+01

query I
SELECT TandAgg(v::tbool)::VARCHAR FROM (VALUES ('true@2000-01-01'),('true@2000-01-02')) t(v);
----
{t@2000-01-01 00:00:00+01, t@2000-01-02 00:00:00+01}

query I
SELECT tOr(v::tbool)::VARCHAR FROM (VALUES ('true@2000-01-01'),('false@2000-01-02')) t(v);
SELECT TorAgg(v::tbool)::VARCHAR FROM (VALUES ('true@2000-01-01'),('false@2000-01-02')) t(v);
----
{t@2000-01-01 00:00:00+01, f@2000-01-02 00:00:00+01}

Expand Down
2 changes: 1 addition & 1 deletion test/sql/parity/091_baseval_scalar_accessors.test
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ SELECT route(npoint 'NPoint(1,0.5)');
1

query I
SELECT "position"(npoint 'NPoint(1,0.5)');
SELECT getPosition(npoint 'NPoint(1,0.5)');
----
0.5

Expand Down
30 changes: 28 additions & 2 deletions test/sql/th3index.test
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ SELECT numTimestamps(th3index('SRID=4326;[Point(1 1)@2000-01-01]'::tgeompoint, 5

# ── H3-specific accessor: the cell resolution tracks the requested resolution ─
query I
SELECT startValue(th3GetResolution(th3index('SRID=4326;[Point(1 1)@2000-01-01]'::tgeompoint, 5)));
SELECT startValue(getResolution(th3index('SRID=4326;[Point(1 1)@2000-01-01]'::tgeompoint, 5)));
----
5

query I
SELECT startValue(th3GetResolution(th3index('SRID=4326;[Point(1 1)@2000-01-01]'::tgeompoint, 8)));
SELECT startValue(getResolution(th3index('SRID=4326;[Point(1 1)@2000-01-01]'::tgeompoint, 8)));
----
8

Expand Down Expand Up @@ -78,3 +78,29 @@ SELECT getValues(th3index('SRID=4326;[Point(1 1)@2000-01-01]'::tgeompoint, 5))[1
= startValue(th3index('SRID=4326;[Point(1 1)@2000-01-01]'::tgeompoint, 5));
----
true

# ── the shared DGGS cell-index slots, answered from the tcellindex kernel ─────
# MobilityDB backs getResolution/cellArea/cellToParent/isValidCell for every cell
# index from one kernel, under the bare slot names. cellToPoint is NOT among them
# for H3: it answers geodetically from th3index_to_tgeogpoint, and the tgeogpoint
# overload above is that one.
query I
SELECT startValue(isValidCell(th3index('SRID=4326;[Point(1 1)@2000-01-01]'::tgeompoint, 5)));
----
true

query I
SELECT startValue(cellArea(th3index('SRID=4326;[Point(1 1)@2000-01-01]'::tgeompoint, 5))) > 0;
----
true

query I
SELECT startValue(cellToParent(th3index('SRID=4326;[Point(1 1)@2000-01-01]'::tgeompoint, 5), 3))::VARCHAR;
----
837541fffffffff

# the parent of a resolution-5 cell at resolution 3 reports resolution 3
query I
SELECT startValue(getResolution(cellToParent(th3index('SRID=4326;[Point(1 1)@2000-01-01]'::tgeompoint, 5), 3)));
----
3
29 changes: 29 additions & 0 deletions test/sql/tquadbin.test
Original file line number Diff line number Diff line change
Expand Up @@ -81,3 +81,32 @@ query I
SELECT getValues(tquadbin(quadbinTileToCell(1,0,1), TIMESTAMPTZ '2024-01-01'))[1];
----
5194902170171867135

# ── the shared DGGS cell-index slots, answered from the tcellindex kernel ─────
# The same kernel answers these for quadbin as for H3, under the bare slot names.
# cellToPoint is quadbin's alone among the temporal cell indexes: it returns the
# planar tgeompoint centroid, where H3 answers cellToPoint geodetically.
query I
SELECT startValue(getResolution(tquadbin(quadbinTileToCell(1,0,1), TIMESTAMPTZ '2024-01-01')));
----
1

query I
SELECT startValue(isValidCell(tquadbin(quadbinTileToCell(1,0,1), TIMESTAMPTZ '2024-01-01')));
----
true

query I
SELECT startValue(cellArea(tquadbin(quadbinTileToCell(1,0,1), TIMESTAMPTZ '2024-01-01'))) > 0;
----
true

query I
SELECT typeof(startValue(cellToPoint(tquadbin(quadbinTileToCell(1,0,1), TIMESTAMPTZ '2024-01-01'))));
----
GEOMETRY

query I
SELECT startValue(cellToParent(tquadbin(quadbinTileToCell(1,0,1), TIMESTAMPTZ '2024-01-01'), 0))::VARCHAR;
----
5192650370358181887
19 changes: 19 additions & 0 deletions tools/codegen_duck_udfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -515,6 +515,25 @@ def reg_scope(name):
# variants auto-exclude on their unmarshallable arg/return.
if name.startswith("tquadbin_") or re.search(r'_tquadbin(?=_|$)', name):
return ("types", ["QuadbinTypes::tquadbin()"])
# the DGGS cell-index operations MobilityDB backs with ONE shared kernel over the cell
# indexes (tcellindex_get_resolution/cell_area/cell_to_parent/cell_to_boundary/
# cell_to_point/is_valid_cell). The kernel carries no family token of its own, and which
# families it serves is NOT uniform: a family that answers a slot from its own kernel is
# absent from this one (cellToPoint is quadbin alone, h3 answering it geodetically from
# th3index_to_tgeogpoint), and the returns differ per family (cellToBoundary is tgeometry
# for quadbin and tgeography for h3). No name heuristic expresses that, so defer to the
# catalog: "all" hands the function to sig_declared_accs, which registers exactly the
# overloads MobilityDB CREATE FUNCTIONs.
# ⛔ cell_to_boundary is the one slot whose answer LEAVES the family — the catalog declares
# tgeography for th3index and tgeometry for tquadbin — and ret_temporal_type answers the
# operand's own type for a Temporal->Temporal function. Registering it would label a
# geography as a cell. Reading the return from the catalog per overload is the fix, and it
# moves six unrelated registrations (centroid, minDistSimplify, <->) that each need their
# own adjudication, so this slot DECLINES until that lands: absent, never mislabelled.
if name.startswith("tcellindex_cell_to_boundary"):
return None
if name.startswith("tcellindex_") or re.search(r'_tcellindex(?=_|$)', name):
return ("all", None)
# the temporal JSONB family (its own gated non-spatial type): a tjsonb_* prefix, or a
# _tjsonb token anywhere. The base-jsonb-value-coupled variants (startValue/atValue with a
# Jsonb arg/return) auto-exclude on their unmarshallable Jsonb arg/return until the base
Expand Down
2 changes: 1 addition & 1 deletion vcpkg_ports/meos/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# libmeos recompile per build) and makes two runs of the same commit build different
# sources. A recorded SHA keeps builds reproducible and the cache warm between
# advances.
set(_MEOS_REF "7289763f0fe89dde2d27d04605325f563783d133")
set(_MEOS_REF "4649cab1afeca4190826bc8ed2ed664056cabcca")
message(STATUS "MEOS port: building MobilityDB at recorded ${_MEOS_REF}")

# FETCH_REF names the branch (always advertised) so the fetch works even when the
Expand Down
Loading