From 1e4d3e43265d69ed8ef9c8beae383c646e4412a0 Mon Sep 17 00:00:00 2001 From: Esteban Zimanyi Date: Thu, 14 May 2026 08:59:20 +0200 Subject: [PATCH 01/13] Bump pinned MEOS to dd4ccd3c2 (post-rename + post-spatial-rels-orthogonalization) The previous portfile pinned REF f11b7443e (Mar 30) with a SHA512 that actually corresponded to a different commit (742c1fb5), masked by vcpkg SHA-cache lottery. Move both REF and SHA512 to MobilityDB master HEAD dd4ccd3c2 so the pin is internally consistent. This bump crosses two breaking MEOS API changes that need separate follow-up commits to compile cleanly: * meosType -> MeosType (#790, Apr 28): the forward-compat alias in src/include/tydef.hpp now resolves cleanly. * Drop restr/atvalue from spatiotemporal relationship functions (#778, Apr 28): the 4-arg tcontains_geo_tgeo / tdisjoint_* / tintersects_* / ttouches_* / tdwithin_* / tpoint_minus_geom calls in src/geo/tgeompoint_functions.cpp must be reworked to the new 2-arg / 3-arg signatures. Restriction semantics moves to post-hoc atValues per MEOS PR #778's migration recipe; the DuckDB public surface drops the (BOOLEAN) overloads to mirror the orthogonalized MEOS shape. --- vcpkg_ports/meos/portfile.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vcpkg_ports/meos/portfile.cmake b/vcpkg_ports/meos/portfile.cmake index 2a2a5614..57fd92eb 100644 --- a/vcpkg_ports/meos/portfile.cmake +++ b/vcpkg_ports/meos/portfile.cmake @@ -1,8 +1,8 @@ vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO MobilityDB/MobilityDB - REF f11b7443ee985dc1ffb778c325e62f0edaf255ec - SHA512 ae8589acc86016c601f9c3c157e94b35e6e8fc50d6194d26db510d51e65a6e751279a3ced258a6bb6e56a22e083993aaeab92f20b9d18d41c7a2c8c73b7dc9df + REF dd4ccd3c2812af88716a318764c837fa5354c5f4 + SHA512 4e2e7077a5bd3bce0681047448352b3c6a784aad15e89f2a65feb01b71a6329ffc926079c6ae2dccb8510b797d92b2c4c6a9e0e89ecf737997eabe1880e22a14 ) vcpkg_replace_string( From 99d6711a9913663aac8ff112b9f6ba6be94b8d48 Mon Sep 17 00:00:00 2001 From: Esteban Zimanyi Date: Thu, 14 May 2026 09:11:19 +0200 Subject: [PATCH 02/13] Drop restr/at_value from spatiotemporal relationship surfaces --- src/geo/tgeogpoint.cpp | 117 -------------- src/geo/tgeompoint.cpp | 144 ++--------------- src/geo/tgeompoint_functions.cpp | 270 +++++++++---------------------- test/sql/tgeompoint.test | 8 +- 4 files changed, 99 insertions(+), 440 deletions(-) diff --git a/src/geo/tgeogpoint.cpp b/src/geo/tgeogpoint.cpp index 3e205f66..42e068e1 100644 --- a/src/geo/tgeogpoint.cpp +++ b/src/geo/tgeogpoint.cpp @@ -1160,15 +1160,6 @@ void TgeogpointType::RegisterScalarFunctions(ExtensionLoader &loader) { ) ); - duckdb::RegisterSerializedScalarFunction(loader, - ScalarFunction( - "minusGeometry", - {TGEOGPOINT(), GeoTypes::GEOMETRY(), SpanTypes::FLOATSPAN()}, - TGEOGPOINT(), - TgeompointFunctions::Tgeo_minus_geom - ) - ); - duckdb::RegisterSerializedScalarFunction(loader, ScalarFunction( "atStbox", @@ -1463,15 +1454,6 @@ void TgeogpointType::RegisterScalarFunctions(ExtensionLoader &loader) { ) ); - duckdb::RegisterSerializedScalarFunction(loader, - ScalarFunction( - "tContains", - {GeoTypes::GEOMETRY(), TGEOGPOINT(), LogicalType::BOOLEAN}, - TemporalTypes::TBOOL(), - TgeompointFunctions::Tcontains_geo_tgeo - ) - ); - duckdb::RegisterSerializedScalarFunction(loader, ScalarFunction( "tDisjoint", @@ -1481,15 +1463,6 @@ void TgeogpointType::RegisterScalarFunctions(ExtensionLoader &loader) { ) ); - duckdb::RegisterSerializedScalarFunction(loader, - ScalarFunction( - "tDisjoint", - {TGEOGPOINT(), GeoTypes::GEOMETRY(), LogicalType::BOOLEAN}, - TemporalTypes::TBOOL(), - TgeompointFunctions::Tdisjoint_tgeo_geo - ) - ); - duckdb::RegisterSerializedScalarFunction(loader, ScalarFunction( "tDisjoint", @@ -1499,24 +1472,6 @@ void TgeogpointType::RegisterScalarFunctions(ExtensionLoader &loader) { ) ); - duckdb::RegisterSerializedScalarFunction(loader, - ScalarFunction( - "tDisjoint", - {GeoTypes::GEOMETRY(), TGEOGPOINT(), LogicalType::BOOLEAN}, - TemporalTypes::TBOOL(), - TgeompointFunctions::Tdisjoint_geo_tgeo - ) - ); - - duckdb::RegisterSerializedScalarFunction(loader, - ScalarFunction( - "tDisjoint", - {TGEOGPOINT(), TGEOGPOINT(), LogicalType::BOOLEAN}, - TemporalTypes::TBOOL(), - TgeompointFunctions::Tdisjoint_tgeo_tgeo - ) - ); - duckdb::RegisterSerializedScalarFunction(loader, ScalarFunction( "tDisjoint", @@ -1526,15 +1481,6 @@ void TgeogpointType::RegisterScalarFunctions(ExtensionLoader &loader) { ) ); - duckdb::RegisterSerializedScalarFunction(loader, - ScalarFunction( - "tIntersects", - {GeoTypes::GEOMETRY(), TGEOGPOINT(), LogicalType::BOOLEAN}, - TemporalTypes::TBOOL(), - TgeompointFunctions::Tintersects_geo_tgeo - ) - ); - duckdb::RegisterSerializedScalarFunction(loader, ScalarFunction( "tIntersects", @@ -1544,15 +1490,6 @@ void TgeogpointType::RegisterScalarFunctions(ExtensionLoader &loader) { ) ); - duckdb::RegisterSerializedScalarFunction(loader, - ScalarFunction( - "tIntersects", - {TGEOGPOINT(), GeoTypes::GEOMETRY(), LogicalType::BOOLEAN}, - TemporalTypes::TBOOL(), - TgeompointFunctions::Tintersects_tgeo_geo - ) - ); - duckdb::RegisterSerializedScalarFunction(loader, ScalarFunction( "tIntersects", @@ -1562,15 +1499,6 @@ void TgeogpointType::RegisterScalarFunctions(ExtensionLoader &loader) { ) ); - duckdb::RegisterSerializedScalarFunction(loader, - ScalarFunction( - "tIntersects", - {TGEOGPOINT(), TGEOGPOINT(), LogicalType::BOOLEAN}, - TemporalTypes::TBOOL(), - TgeompointFunctions::Tintersects_tgeo_tgeo - ) - ); - duckdb::RegisterSerializedScalarFunction(loader, ScalarFunction( "tIntersects", @@ -1580,15 +1508,6 @@ void TgeogpointType::RegisterScalarFunctions(ExtensionLoader &loader) { ) ); - duckdb::RegisterSerializedScalarFunction(loader, - ScalarFunction( - "tTouches", - {GeoTypes::GEOMETRY(), TGEOGPOINT(), LogicalType::BOOLEAN}, - TemporalTypes::TBOOL(), - TgeompointFunctions::Ttouches_geo_tgeo - ) - ); - duckdb::RegisterSerializedScalarFunction(loader, ScalarFunction( "tTouches", @@ -1598,15 +1517,6 @@ void TgeogpointType::RegisterScalarFunctions(ExtensionLoader &loader) { ) ); - duckdb::RegisterSerializedScalarFunction(loader, - ScalarFunction( - "tTouches", - {TGEOGPOINT(), GeoTypes::GEOMETRY(), LogicalType::BOOLEAN}, - TemporalTypes::TBOOL(), - TgeompointFunctions::Ttouches_tgeo_geo - ) - ); - duckdb::RegisterSerializedScalarFunction(loader, ScalarFunction( "tTouches", @@ -1625,24 +1535,6 @@ void TgeogpointType::RegisterScalarFunctions(ExtensionLoader &loader) { ) ); - duckdb::RegisterSerializedScalarFunction(loader, - ScalarFunction( - "tDwithin", - {GeoTypes::GEOMETRY(), TGEOGPOINT(), LogicalType::DOUBLE, LogicalType::BOOLEAN}, - TemporalTypes::TBOOL(), - TgeompointFunctions::Tdwithin_geo_tgeo - ) - ); - - duckdb::RegisterSerializedScalarFunction(loader, - ScalarFunction( - "tDwithin", - {TGEOGPOINT(), GeoTypes::GEOMETRY(), LogicalType::DOUBLE, LogicalType::BOOLEAN}, - TemporalTypes::TBOOL(), - TgeompointFunctions::Tdwithin_tgeo_geo - ) - ); - duckdb::RegisterSerializedScalarFunction(loader, ScalarFunction( "tDwithin", @@ -1661,15 +1553,6 @@ void TgeogpointType::RegisterScalarFunctions(ExtensionLoader &loader) { ) ); - duckdb::RegisterSerializedScalarFunction(loader, - ScalarFunction( - "tDwithin", - {TGEOGPOINT(), TGEOGPOINT(), LogicalType::DOUBLE, LogicalType::BOOLEAN}, - TemporalTypes::TBOOL(), - TgeompointFunctions::Tdwithin_tgeo_tgeo - ) - ); - /* *************************************************** * Operators (workaround as functions) ****************************************************/ diff --git a/src/geo/tgeompoint.cpp b/src/geo/tgeompoint.cpp index 2bc5e6a0..4f99e60f 100644 --- a/src/geo/tgeompoint.cpp +++ b/src/geo/tgeompoint.cpp @@ -1188,16 +1188,7 @@ void TgeompointType::RegisterScalarFunctions(ExtensionLoader &loader) { ) ); - duckdb::RegisterSerializedScalarFunction(loader, - ScalarFunction( - "minusGeometry", - {TGEOMPOINT(), GeoTypes::GEOMETRY(), SpanTypes::FLOATSPAN()}, - TGEOMPOINT(), - TgeompointFunctions::Tgeo_minus_geom - ) - ); - - duckdb::RegisterSerializedScalarFunction(loader, + duckdb::RegisterSerializedScalarFunction(loader, ScalarFunction( "atStbox", {TGEOMPOINT(), StboxType::STBOX()}, @@ -1479,7 +1470,7 @@ void TgeompointType::RegisterScalarFunctions(ExtensionLoader &loader) { /* *************************************************** * Temporal-spatial relationships ****************************************************/ - duckdb::RegisterSerializedScalarFunction(loader, + duckdb::RegisterSerializedScalarFunction(loader, ScalarFunction( "tContains", {GeoTypes::GEOMETRY(), TGEOMPOINT()}, @@ -1487,17 +1478,8 @@ void TgeompointType::RegisterScalarFunctions(ExtensionLoader &loader) { TgeompointFunctions::Tcontains_geo_tgeo ) ); - - duckdb::RegisterSerializedScalarFunction(loader, - ScalarFunction( - "tContains", - {GeoTypes::GEOMETRY(), TGEOMPOINT(), LogicalType::BOOLEAN}, - TemporalTypes::TBOOL(), - TgeompointFunctions::Tcontains_geo_tgeo - ) - ); - duckdb::RegisterSerializedScalarFunction(loader, + duckdb::RegisterSerializedScalarFunction(loader, ScalarFunction( "tDisjoint", {TGEOMPOINT(), GeoTypes::GEOMETRY()}, @@ -1506,16 +1488,7 @@ void TgeompointType::RegisterScalarFunctions(ExtensionLoader &loader) { ) ); - duckdb::RegisterSerializedScalarFunction(loader, - ScalarFunction( - "tDisjoint", - {TGEOMPOINT(), GeoTypes::GEOMETRY(), LogicalType::BOOLEAN}, - TemporalTypes::TBOOL(), - TgeompointFunctions::Tdisjoint_tgeo_geo - ) - ); - - duckdb::RegisterSerializedScalarFunction(loader, + duckdb::RegisterSerializedScalarFunction(loader, ScalarFunction( "tDisjoint", {GeoTypes::GEOMETRY(), TGEOMPOINT()}, @@ -1524,43 +1497,16 @@ void TgeompointType::RegisterScalarFunctions(ExtensionLoader &loader) { ) ); - duckdb::RegisterSerializedScalarFunction(loader, - ScalarFunction( - "tDisjoint", - {GeoTypes::GEOMETRY(), TGEOMPOINT(), LogicalType::BOOLEAN}, - TemporalTypes::TBOOL(), - TgeompointFunctions::Tdisjoint_geo_tgeo - ) - ); - - duckdb::RegisterSerializedScalarFunction(loader, - ScalarFunction( - "tDisjoint", - {TGEOMPOINT(), TGEOMPOINT(), LogicalType::BOOLEAN}, - TemporalTypes::TBOOL(), - TgeompointFunctions::Tdisjoint_tgeo_tgeo - ) - ); - - duckdb::RegisterSerializedScalarFunction(loader, + duckdb::RegisterSerializedScalarFunction(loader, ScalarFunction( "tDisjoint", {TGEOMPOINT(), TGEOMPOINT()}, TemporalTypes::TBOOL(), - TgeompointFunctions::Tdisjoint_tgeo_tgeo + TgeompointFunctions::Tdisjoint_tgeo_tgeo ) ); - duckdb::RegisterSerializedScalarFunction(loader, - ScalarFunction( - "tIntersects", - {GeoTypes::GEOMETRY(), TGEOMPOINT(), LogicalType::BOOLEAN}, - TemporalTypes::TBOOL(), - TgeompointFunctions::Tintersects_geo_tgeo - ) - ); - - duckdb::RegisterSerializedScalarFunction(loader, + duckdb::RegisterSerializedScalarFunction(loader, ScalarFunction( "tIntersects", {GeoTypes::GEOMETRY(), TGEOMPOINT()}, @@ -1569,16 +1515,7 @@ void TgeompointType::RegisterScalarFunctions(ExtensionLoader &loader) { ) ); - duckdb::RegisterSerializedScalarFunction(loader, - ScalarFunction( - "tIntersects", - {TGEOMPOINT(), GeoTypes::GEOMETRY(), LogicalType::BOOLEAN}, - TemporalTypes::TBOOL(), - TgeompointFunctions::Tintersects_tgeo_geo - ) - ); - - duckdb::RegisterSerializedScalarFunction(loader, + duckdb::RegisterSerializedScalarFunction(loader, ScalarFunction( "tIntersects", {TGEOMPOINT(), GeoTypes::GEOMETRY()}, @@ -1587,15 +1524,7 @@ void TgeompointType::RegisterScalarFunctions(ExtensionLoader &loader) { ) ); - duckdb::RegisterSerializedScalarFunction(loader, - ScalarFunction( - "tIntersects", - {TGEOMPOINT(), TGEOMPOINT(), LogicalType::BOOLEAN}, - TemporalTypes::TBOOL(), - TgeompointFunctions::Tintersects_tgeo_tgeo - ) - ); - duckdb::RegisterSerializedScalarFunction(loader, + duckdb::RegisterSerializedScalarFunction(loader, ScalarFunction( "tIntersects", {TGEOMPOINT(), TGEOMPOINT()}, @@ -1604,15 +1533,7 @@ void TgeompointType::RegisterScalarFunctions(ExtensionLoader &loader) { ) ); - duckdb::RegisterSerializedScalarFunction(loader, - ScalarFunction( - "tTouches", - {GeoTypes::GEOMETRY(), TGEOMPOINT(), LogicalType::BOOLEAN}, - TemporalTypes::TBOOL(), - TgeompointFunctions::Ttouches_geo_tgeo - ) - ); - duckdb::RegisterSerializedScalarFunction(loader, + duckdb::RegisterSerializedScalarFunction(loader, ScalarFunction( "tTouches", {GeoTypes::GEOMETRY(), TGEOMPOINT()}, @@ -1620,15 +1541,8 @@ void TgeompointType::RegisterScalarFunctions(ExtensionLoader &loader) { TgeompointFunctions::Ttouches_geo_tgeo ) ); - duckdb::RegisterSerializedScalarFunction(loader, - ScalarFunction( - "tTouches", - {TGEOMPOINT(), GeoTypes::GEOMETRY(), LogicalType::BOOLEAN}, - TemporalTypes::TBOOL(), - TgeompointFunctions::Ttouches_tgeo_geo - ) - ); - duckdb::RegisterSerializedScalarFunction(loader, + + duckdb::RegisterSerializedScalarFunction(loader, ScalarFunction( "tTouches", {TGEOMPOINT(), GeoTypes::GEOMETRY()}, @@ -1636,34 +1550,17 @@ void TgeompointType::RegisterScalarFunctions(ExtensionLoader &loader) { TgeompointFunctions::Ttouches_tgeo_geo ) ); - duckdb::RegisterSerializedScalarFunction(loader, - ScalarFunction( - "tDwithin", - {GeoTypes::GEOMETRY(), TGEOMPOINT(), LogicalType::DOUBLE}, - TemporalTypes::TBOOL(), - TgeompointFunctions::Tdwithin_geo_tgeo - ) - ); - duckdb::RegisterSerializedScalarFunction(loader, + duckdb::RegisterSerializedScalarFunction(loader, ScalarFunction( "tDwithin", - {GeoTypes::GEOMETRY(), TGEOMPOINT(), LogicalType::DOUBLE, LogicalType::BOOLEAN}, + {GeoTypes::GEOMETRY(), TGEOMPOINT(), LogicalType::DOUBLE}, TemporalTypes::TBOOL(), TgeompointFunctions::Tdwithin_geo_tgeo ) ); - duckdb::RegisterSerializedScalarFunction(loader, - ScalarFunction( - "tDwithin", - {TGEOMPOINT(), GeoTypes::GEOMETRY(), LogicalType::DOUBLE, LogicalType::BOOLEAN}, - TemporalTypes::TBOOL(), - TgeompointFunctions::Tdwithin_tgeo_geo - ) - ); - - duckdb::RegisterSerializedScalarFunction(loader, + duckdb::RegisterSerializedScalarFunction(loader, ScalarFunction( "tDwithin", {TGEOMPOINT(), GeoTypes::GEOMETRY(), LogicalType::DOUBLE}, @@ -1672,7 +1569,7 @@ void TgeompointType::RegisterScalarFunctions(ExtensionLoader &loader) { ) ); - duckdb::RegisterSerializedScalarFunction(loader, + duckdb::RegisterSerializedScalarFunction(loader, ScalarFunction( "tDwithin", {TGEOMPOINT(), TGEOMPOINT(), LogicalType::DOUBLE}, @@ -1680,15 +1577,6 @@ void TgeompointType::RegisterScalarFunctions(ExtensionLoader &loader) { TgeompointFunctions::Tdwithin_tgeo_tgeo ) ); - - duckdb::RegisterSerializedScalarFunction(loader, - ScalarFunction( - "tDwithin", - {TGEOMPOINT(), TGEOMPOINT(), LogicalType::DOUBLE, LogicalType::BOOLEAN}, - TemporalTypes::TBOOL(), - TgeompointFunctions::Tdwithin_tgeo_tgeo - ) - ); /* *************************************************** diff --git a/src/geo/tgeompoint_functions.cpp b/src/geo/tgeompoint_functions.cpp index 9092e6e4..02f3fccb 100644 --- a/src/geo/tgeompoint_functions.cpp +++ b/src/geo/tgeompoint_functions.cpp @@ -1264,75 +1264,45 @@ void TgeompointFunctions::Tgeo_at_geom(DataChunk &args, ExpressionState &state, void TgeompointFunctions::Tgeo_minus_geom(DataChunk &args, ExpressionState &state, Vector &result) { const idx_t count = args.size(); - auto minus_geom_common = [&](string_t tgeom_blob, string_t geometry_blob, const Span *zspan, - ValidityMask &mask, idx_t idx) -> string_t { - const uint8_t *tgeom_data = reinterpret_cast(tgeom_blob.GetData()); - size_t tgeom_data_size = tgeom_blob.GetSize(); - if (tgeom_data_size < sizeof(void *)) { - throw InvalidInputException("Invalid TGEOMPOINT data: insufficient size"); - } - uint8_t *tgeom_data_copy = (uint8_t *)malloc(tgeom_data_size); - memcpy(tgeom_data_copy, tgeom_data, tgeom_data_size); - Temporal *tgeom = reinterpret_cast(tgeom_data_copy); - if (!tgeom) { - free(tgeom_data_copy); - throw InvalidInputException("Invalid TGEOMPOINT data: null pointer"); - } + BinaryExecutor::ExecuteWithNulls( + args.data[0], args.data[1], result, count, + [&](string_t tgeom_blob, string_t geometry_blob, ValidityMask &mask, idx_t idx) -> string_t { + const uint8_t *tgeom_data = reinterpret_cast(tgeom_blob.GetData()); + size_t tgeom_data_size = tgeom_blob.GetSize(); + if (tgeom_data_size < sizeof(void *)) { + throw InvalidInputException("Invalid TGEOMPOINT data: insufficient size"); + } + uint8_t *tgeom_data_copy = (uint8_t *)malloc(tgeom_data_size); + memcpy(tgeom_data_copy, tgeom_data, tgeom_data_size); + Temporal *tgeom = reinterpret_cast(tgeom_data_copy); + if (!tgeom) { + free(tgeom_data_copy); + throw InvalidInputException("Invalid TGEOMPOINT data: null pointer"); + } - int32 srid = tspatial_srid(tgeom); - GSERIALIZED *gs = GeometryToGSerialized(geometry_blob, srid); - if (!gs) { - free(tgeom); - throw InvalidInputException("Invalid geometry format: " + geometry_blob.GetString()); - } + int32 srid = tspatial_srid(tgeom); + GSERIALIZED *gs = GeometryToGSerialized(geometry_blob, srid); + if (!gs) { + free(tgeom); + throw InvalidInputException("Invalid geometry format: " + geometry_blob.GetString()); + } - Temporal *ret = zspan ? tpoint_minus_geom(tgeom, gs, zspan) : tgeo_minus_geom(tgeom, gs); - free(tgeom); - free(gs); - if (!ret) { - mask.SetInvalid(idx); - return string_t(); - } - size_t ret_size = temporal_mem_size(ret); - uint8_t *ret_data = (uint8_t *)malloc(ret_size); - memcpy(ret_data, ret, ret_size); - string_t ret_string(reinterpret_cast(ret_data), ret_size); - string_t stored_data = StringVector::AddStringOrBlob(result, ret_string); - free(ret_data); - free(ret); - return stored_data; - }; - - if (args.ColumnCount() == 2) { - BinaryExecutor::ExecuteWithNulls( - args.data[0], args.data[1], result, count, - [&](string_t tgeom_blob, string_t geometry_blob, ValidityMask &mask, idx_t idx) -> string_t { - return minus_geom_common(tgeom_blob, geometry_blob, nullptr, mask, idx); - }); - } else if (args.ColumnCount() == 3) { - TernaryExecutor::ExecuteWithNulls( - args.data[0], args.data[1], args.data[2], result, count, - [&](string_t tgeom_blob, string_t geometry_blob, string_t span_blob, ValidityMask &mask, - idx_t idx) -> string_t { - size_t span_size = span_blob.GetSize(); - if (span_size < sizeof(void *)) { - throw InvalidInputException("Invalid floatspan data: insufficient size"); - } - uint8_t *span_copy = (uint8_t *)malloc(span_size); - memcpy(span_copy, span_blob.GetData(), span_size); - Span *zspan = reinterpret_cast(span_copy); - try { - string_t out = minus_geom_common(tgeom_blob, geometry_blob, zspan, mask, idx); - free(span_copy); - return out; - } catch (...) { - free(span_copy); - throw; - } - }); - } else { - throw InternalException("Tgeo_minus_geom: expected 2 or 3 arguments"); - } + Temporal *ret = tgeo_minus_geom(tgeom, gs); + free(tgeom); + free(gs); + if (!ret) { + mask.SetInvalid(idx); + return string_t(); + } + size_t ret_size = temporal_mem_size(ret); + uint8_t *ret_data = (uint8_t *)malloc(ret_size); + memcpy(ret_data, ret, ret_size); + string_t ret_string(reinterpret_cast(ret_data), ret_size); + string_t stored_data = StringVector::AddStringOrBlob(result, ret_string); + free(ret_data); + free(ret); + return stored_data; + }); if (count == 1) { result.SetVectorType(VectorType::CONSTANT_VECTOR); @@ -2419,67 +2389,45 @@ void TgeompointFunctions::Adwithin_tgeo_tgeo(DataChunk &args, ExpressionState &s ****************************************************/ void TgeompointFunctions::Tcontains_geo_tgeo(DataChunk &args, ExpressionState &state, Vector &result) { const idx_t count = args.size(); - auto eval = [&](string_t geometry_blob, string_t tgeom_blob, bool restr, bool at_value, ValidityMask &mask, - idx_t idx) -> string_t { - int32 srid = 0; - GSERIALIZED *gs = GeometryToGSerialized(geometry_blob, srid); - if (!gs) { - throw InvalidInputException("Invalid geometry format: " + geometry_blob.GetString()); - } - - const uint8_t *tgeom_data = reinterpret_cast(tgeom_blob.GetData()); - size_t tgeom_data_size = tgeom_blob.GetSize(); - uint8_t *tgeom_data_copy = (uint8_t *)malloc(tgeom_data_size); - memcpy(tgeom_data_copy, tgeom_data, tgeom_data_size); - Temporal *tgeom = reinterpret_cast(tgeom_data_copy); - if (!tgeom) { - free(tgeom_data_copy); - free(gs); - throw InvalidInputException("Invalid TGEOMPOINT data: null pointer"); - } + BinaryExecutor::ExecuteWithNulls( + args.data[0], args.data[1], result, count, + [&](string_t geometry_blob, string_t tgeom_blob, ValidityMask &mask, idx_t idx) -> string_t { + int32 srid = 0; + GSERIALIZED *gs = GeometryToGSerialized(geometry_blob, srid); + if (!gs) { + throw InvalidInputException("Invalid geometry format: " + geometry_blob.GetString()); + } - Temporal *ret = tcontains_geo_tgeo(gs, tgeom, restr, at_value); - free(tgeom); - free(gs); - if (!ret) { - mask.SetInvalid(idx); - return string_t(); - } - size_t ret_size = temporal_mem_size(ret); - string_t stored_data = - StringVector::AddStringOrBlob(result, reinterpret_cast(ret), ret_size); - free(ret); - return stored_data; - }; + const uint8_t *tgeom_data = reinterpret_cast(tgeom_blob.GetData()); + size_t tgeom_data_size = tgeom_blob.GetSize(); + uint8_t *tgeom_data_copy = (uint8_t *)malloc(tgeom_data_size); + memcpy(tgeom_data_copy, tgeom_data, tgeom_data_size); + Temporal *tgeom = reinterpret_cast(tgeom_data_copy); + if (!tgeom) { + free(tgeom_data_copy); + free(gs); + throw InvalidInputException("Invalid TGEOMPOINT data: null pointer"); + } - if (args.ColumnCount() == 2) { - BinaryExecutor::ExecuteWithNulls( - args.data[0], args.data[1], result, count, - [&](string_t geometry_blob, string_t tgeom_blob, ValidityMask &mask, idx_t idx) -> string_t { - return eval(geometry_blob, tgeom_blob, false, false, mask, idx); - }); - } else if (args.ColumnCount() == 3) { - TernaryExecutor::ExecuteWithNulls( - args.data[0], args.data[1], args.data[2], result, count, - [&](string_t geometry_blob, string_t tgeom_blob, bool at_value, ValidityMask &mask, - idx_t idx) -> string_t { - return eval(geometry_blob, tgeom_blob, true, at_value, mask, idx); - }); - } else { - throw InternalException("Tcontains_geo_tgeo: expected 2 or 3 arguments"); - } + Temporal *ret = tcontains_geo_tgeo(gs, tgeom); + free(tgeom); + free(gs); + if (!ret) { + mask.SetInvalid(idx); + return string_t(); + } + size_t ret_size = temporal_mem_size(ret); + string_t stored_data = + StringVector::AddStringOrBlob(result, reinterpret_cast(ret), ret_size); + free(ret); + return stored_data; + }); if (count == 1) { result.SetVectorType(VectorType::CONSTANT_VECTOR); } } void TgeompointFunctions::Tdisjoint_geo_tgeo(DataChunk &args, ExpressionState &state, Vector &result) { - bool at_value = false; - bool restr = false; - if (args.ColumnCount() > 2){ - at_value = args.data[2].GetValue(0).GetValue(); - restr = true; - } BinaryExecutor::ExecuteWithNulls( args.data[0], args.data[1], result, args.size(), [&](string_t geometry_blob, string_t tgeom_blob, ValidityMask &mask, idx_t idx) -> string_t { @@ -2500,7 +2448,7 @@ void TgeompointFunctions::Tdisjoint_geo_tgeo(DataChunk &args, ExpressionState &s throw InvalidInputException("Invalid TGEOMPOINT data: null pointer"); } - Temporal *ret = tdisjoint_geo_tgeo(gs, tgeom, restr, at_value); + Temporal *ret = tdisjoint_geo_tgeo(gs, tgeom); free(tgeom); free(gs); if (!ret) { @@ -2519,12 +2467,6 @@ void TgeompointFunctions::Tdisjoint_geo_tgeo(DataChunk &args, ExpressionState &s } void TgeompointFunctions::Tdisjoint_tgeo_geo(DataChunk &args, ExpressionState &state, Vector &result) { - bool at_value = false; - bool restr = false; - if (args.ColumnCount() > 2){ - at_value = args.data[2].GetValue(0).GetValue(); - restr = true; - } BinaryExecutor::ExecuteWithNulls( args.data[0], args.data[1], result, args.size(), [&](string_t tgeom_blob, string_t geometry_blob, ValidityMask &mask, idx_t idx) -> string_t { @@ -2545,7 +2487,7 @@ void TgeompointFunctions::Tdisjoint_tgeo_geo(DataChunk &args, ExpressionState &s throw InvalidInputException("Invalid TGEOMPOINT data: null pointer"); } - Temporal *ret = tdisjoint_tgeo_geo(tgeom, gs, restr, at_value); + Temporal *ret = tdisjoint_tgeo_geo(tgeom, gs); free(tgeom); free(gs); if (!ret) { @@ -2564,12 +2506,6 @@ void TgeompointFunctions::Tdisjoint_tgeo_geo(DataChunk &args, ExpressionState &s } void TgeompointFunctions::Tdisjoint_tgeo_tgeo(DataChunk &args, ExpressionState &state, Vector &result) { - bool at_value = false; - bool restr = false; - if (args.ColumnCount() > 2){ - at_value = args.data[2].GetValue(0).GetValue(); - restr = true; - } BinaryExecutor::ExecuteWithNulls( args.data[0], args.data[1], result, args.size(), [&](string_t tgeom1_blob, string_t tgeom2_blob, ValidityMask &mask, idx_t idx) -> string_t { @@ -2594,7 +2530,7 @@ void TgeompointFunctions::Tdisjoint_tgeo_tgeo(DataChunk &args, ExpressionState & throw InvalidInputException("Invalid TGEOMPOINT data: null pointer"); } - Temporal *ret = tdisjoint_tgeo_tgeo(tgeom1, tgeom2, restr, at_value); + Temporal *ret = tdisjoint_tgeo_tgeo(tgeom1, tgeom2); free(tgeom1); free(tgeom2); if (!ret) { @@ -2613,12 +2549,6 @@ void TgeompointFunctions::Tdisjoint_tgeo_tgeo(DataChunk &args, ExpressionState & } void TgeompointFunctions::Tintersects_geo_tgeo(DataChunk &args, ExpressionState &state, Vector &result) { - bool at_value = false; - bool restr = false; - if (args.ColumnCount() > 2){ - at_value = args.data[2].GetValue(0).GetValue(); - restr = true; - } BinaryExecutor::ExecuteWithNulls( args.data[0], args.data[1], result, args.size(), [&](string_t geometry_blob, string_t tgeom_blob, ValidityMask &mask, idx_t idx) -> string_t { @@ -2639,7 +2569,7 @@ void TgeompointFunctions::Tintersects_geo_tgeo(DataChunk &args, ExpressionState throw InvalidInputException("Invalid TGEOMPOINT data: null pointer"); } - Temporal *ret = tintersects_geo_tgeo(gs, tgeom, restr, at_value); + Temporal *ret = tintersects_geo_tgeo(gs, tgeom); free(tgeom); free(gs); if (!ret) { @@ -2658,12 +2588,6 @@ void TgeompointFunctions::Tintersects_geo_tgeo(DataChunk &args, ExpressionState } void TgeompointFunctions::Tintersects_tgeo_geo(DataChunk &args, ExpressionState &state, Vector &result) { - bool at_value = false; - bool restr = false; - if (args.ColumnCount() > 2){ - at_value = args.data[2].GetValue(0).GetValue(); - restr = true; - } BinaryExecutor::ExecuteWithNulls( args.data[0], args.data[1], result, args.size(), [&](string_t tgeom_blob, string_t geometry_blob, ValidityMask &mask, idx_t idx) -> string_t { @@ -2684,7 +2608,7 @@ void TgeompointFunctions::Tintersects_tgeo_geo(DataChunk &args, ExpressionState throw InvalidInputException("Invalid TGEOMPOINT data: null pointer"); } - Temporal *ret = tintersects_tgeo_geo(tgeom, gs, restr, at_value); + Temporal *ret = tintersects_tgeo_geo(tgeom, gs); free(tgeom); free(gs); if (!ret) { @@ -2703,12 +2627,6 @@ void TgeompointFunctions::Tintersects_tgeo_geo(DataChunk &args, ExpressionState } void TgeompointFunctions::Tintersects_tgeo_tgeo(DataChunk &args, ExpressionState &state, Vector &result) { - bool at_value = false; - bool restr = false; - if (args.ColumnCount() > 2){ - at_value = args.data[2].GetValue(0).GetValue(); - restr = true; - } BinaryExecutor::ExecuteWithNulls( args.data[0], args.data[1], result, args.size(), [&](string_t tgeom1_blob, string_t tgeom2_blob, ValidityMask &mask, idx_t idx) -> string_t { @@ -2733,7 +2651,7 @@ void TgeompointFunctions::Tintersects_tgeo_tgeo(DataChunk &args, ExpressionState throw InvalidInputException("Invalid TGEOMPOINT data: null pointer"); } - Temporal *ret = tintersects_tgeo_tgeo(tgeom1, tgeom2, restr, at_value); + Temporal *ret = tintersects_tgeo_tgeo(tgeom1, tgeom2); free(tgeom1); free(tgeom2); if (!ret) { @@ -2752,12 +2670,6 @@ void TgeompointFunctions::Tintersects_tgeo_tgeo(DataChunk &args, ExpressionState } void TgeompointFunctions::Ttouches_geo_tgeo(DataChunk &args, ExpressionState &state, Vector &result) { - bool at_value = false; - bool restr = false; - if (args.ColumnCount() > 2){ - at_value = args.data[2].GetValue(0).GetValue(); - restr = true; - } BinaryExecutor::ExecuteWithNulls( args.data[0], args.data[1], result, args.size(), [&](string_t geometry_blob, string_t tgeom_blob, ValidityMask &mask, idx_t idx) -> string_t { @@ -2778,7 +2690,7 @@ void TgeompointFunctions::Ttouches_geo_tgeo(DataChunk &args, ExpressionState &st throw InvalidInputException("Invalid TGEOMPOINT data: null pointer"); } - Temporal *ret = ttouches_geo_tgeo(gs, tgeom, restr, at_value); + Temporal *ret = ttouches_geo_tgeo(gs, tgeom); free(tgeom); free(gs); if (!ret) { @@ -2797,12 +2709,6 @@ void TgeompointFunctions::Ttouches_geo_tgeo(DataChunk &args, ExpressionState &st } void TgeompointFunctions::Ttouches_tgeo_geo(DataChunk &args, ExpressionState &state, Vector &result) { - bool at_value = false; - bool restr = false; - if (args.ColumnCount() > 2){ - at_value = args.data[2].GetValue(0).GetValue(); - restr = true; - } BinaryExecutor::ExecuteWithNulls( args.data[0], args.data[1], result, args.size(), [&](string_t tgeom_blob, string_t geometry_blob, ValidityMask &mask, idx_t idx) -> string_t { @@ -2823,7 +2729,7 @@ void TgeompointFunctions::Ttouches_tgeo_geo(DataChunk &args, ExpressionState &st throw InvalidInputException("Invalid TGEOMPOINT data: null pointer"); } - Temporal *ret = ttouches_tgeo_geo(tgeom, gs, restr, at_value); + Temporal *ret = ttouches_tgeo_geo(tgeom, gs); free(tgeom); free(gs); if (!ret) { @@ -2842,12 +2748,6 @@ void TgeompointFunctions::Ttouches_tgeo_geo(DataChunk &args, ExpressionState &st } void TgeompointFunctions::Tdwithin_tgeo_tgeo(DataChunk &args, ExpressionState &state, Vector &result) { - bool at_value = false; - bool restr = false; - if (args.ColumnCount() > 3) { - at_value = args.data[3].GetValue(0).GetValue(); - restr = true; - } TernaryExecutor::ExecuteWithNulls( args.data[0], args.data[1], args.data[2], result, args.size(), [&](string_t tgeom1_blob, string_t tgeom2_blob, double dist, ValidityMask &mask, idx_t idx) -> string_t { @@ -2871,7 +2771,7 @@ void TgeompointFunctions::Tdwithin_tgeo_tgeo(DataChunk &args, ExpressionState &s free(tgeom2_data_copy); throw InvalidInputException("Invalid TGEOMPOINT data: null pointer"); } - Temporal *ret = tdwithin_tgeo_tgeo(tgeom1, tgeom2, dist, restr, at_value); + Temporal *ret = tdwithin_tgeo_tgeo(tgeom1, tgeom2, dist); if (!ret) { free(tgeom1); free(tgeom2); @@ -2892,12 +2792,6 @@ void TgeompointFunctions::Tdwithin_tgeo_tgeo(DataChunk &args, ExpressionState &s } void TgeompointFunctions::Tdwithin_tgeo_geo(DataChunk &args, ExpressionState &state, Vector &result) { - bool at_value = false; - bool restr = false; - if (args.ColumnCount() > 3) { - at_value = args.data[3].GetValue(0).GetValue(); - restr = true; - } TernaryExecutor::ExecuteWithNulls( args.data[0], args.data[1], args.data[2], result, args.size(), [&](string_t tgeom_blob, string_t geometry_blob, double dist, ValidityMask &mask, idx_t idx) -> string_t { @@ -2918,7 +2812,7 @@ void TgeompointFunctions::Tdwithin_tgeo_geo(DataChunk &args, ExpressionState &st throw InvalidInputException("Invalid geometry format: " + geometry_blob.GetString()); } - Temporal *ret = tdwithin_tgeo_geo(tgeom, gs, dist, restr, at_value); + Temporal *ret = tdwithin_tgeo_geo(tgeom, gs, dist); free(tgeom); free(gs); if (!ret) { @@ -2937,12 +2831,6 @@ void TgeompointFunctions::Tdwithin_tgeo_geo(DataChunk &args, ExpressionState &st } void TgeompointFunctions::Tdwithin_geo_tgeo(DataChunk &args, ExpressionState &state, Vector &result) { - bool at_value = false; - bool restr = false; - if (args.ColumnCount() > 3) { - at_value = args.data[3].GetValue(0).GetValue(); - restr = true; - } TernaryExecutor::ExecuteWithNulls( args.data[0], args.data[1], args.data[2], result, args.size(), [&](string_t geometry_blob, string_t tgeom_blob, double dist, ValidityMask &mask, idx_t idx) -> string_t { @@ -2963,7 +2851,7 @@ void TgeompointFunctions::Tdwithin_geo_tgeo(DataChunk &args, ExpressionState &st throw InvalidInputException("Invalid TGEOMPOINT data: null pointer"); } - Temporal *ret = tdwithin_geo_tgeo(gs, tgeom, dist, restr, at_value); + Temporal *ret = tdwithin_geo_tgeo(gs, tgeom, dist); free(tgeom); free(gs); if (!ret) { diff --git a/test/sql/tgeompoint.test b/test/sql/tgeompoint.test index d0ae0f99..3b9adaf1 100644 --- a/test/sql/tgeompoint.test +++ b/test/sql/tgeompoint.test @@ -698,7 +698,7 @@ SELECT tContains(geometry 'Point(1 1)', tgeompoint 'Point(1 1)@2000-01-01'); t@2000-01-01 00:00:00+01 query I -SELECT tContains(geometry 'Point(1 1)', tgeompoint '[Point(1 1)@2000-01-01, Point(2 2)@2000-01-02, Point(1 1)@2000-01-03]', true); +SELECT atValues(tContains(geometry 'Point(1 1)', tgeompoint '[Point(1 1)@2000-01-01, Point(2 2)@2000-01-02, Point(1 1)@2000-01-03]'), true); ---- {[t@2000-01-01 00:00:00+01], [t@2000-01-03 00:00:00+01]} @@ -713,7 +713,7 @@ SELECT tDisjoint(geometry 'Point(1 1)', tgeompoint '{[Point(1 1)@2000-01-01, Poi {[f@2000-01-01 00:00:00+01], (t@2000-01-01 00:00:00+01, f@2000-01-03 00:00:00+01], [t@2000-01-04 00:00:00+01, t@2000-01-05 00:00:00+01]} query I -SELECT tDisjoint(tgeompoint '{[Point(1 1)@2000-01-01, Point(2 2)@2000-01-02, Point(1 1)@2000-01-03], [Point(3 3)@2000-01-04, Point(3 3)@2000-01-05]}', tgeompoint 'Point(1 1)@2000-01-01', false); +SELECT atValues(tDisjoint(tgeompoint '{[Point(1 1)@2000-01-01, Point(2 2)@2000-01-02, Point(1 1)@2000-01-03], [Point(3 3)@2000-01-04, Point(3 3)@2000-01-05]}', tgeompoint 'Point(1 1)@2000-01-01'), false); ---- f@2000-01-01 00:00:00+01 @@ -723,7 +723,7 @@ SELECT tIntersects(tgeompoint '{Point(1 1 1)@2000-01-01, Point(2 2 2)@2000-01-02 {f@2000-01-01 00:00:00+01, t@2000-01-02 00:00:00+01, f@2000-01-03 00:00:00+01} query I -SELECT tIntersects(tgeompoint 'Point(1 1)@2000-01-01', geometry 'Point(1 1)', true); +SELECT atValues(tIntersects(tgeompoint 'Point(1 1)@2000-01-01', geometry 'Point(1 1)'), true); ---- t@2000-01-01 00:00:00+01 @@ -733,7 +733,7 @@ SELECT tTouches(geometry 'Point(1 1)', tgeompoint '{[Point(1 1)@2000-01-01, Poin {[f@2000-01-01 00:00:00+01, f@2000-01-03 00:00:00+01], [f@2000-01-04 00:00:00+01, f@2000-01-05 00:00:00+01]} query I -SELECT tTouches(tgeompoint '{Point(1 1)@2000-01-01, Point(2 2)@2000-01-02, Point(1 1)@2000-01-03}', geometry 'Point(1 1)', true); +SELECT atValues(tTouches(tgeompoint '{Point(1 1)@2000-01-01, Point(2 2)@2000-01-02, Point(1 1)@2000-01-03}', geometry 'Point(1 1)'), true); ---- NULL From 2473d38a17b02c0fe3adec0642f498b8f356a3fa Mon Sep 17 00:00:00 2001 From: Esteban Zimanyi Date: Thu, 14 May 2026 10:10:19 +0200 Subject: [PATCH 03/13] Rename temptype_continuous to temptype_supports_linear MEOS PR #1005 renamed temptype_continuous to temptype_supports_linear in meos_catalog.h. Update the five call sites in src/geo/tgeompoint_functions.cpp and src/temporal/temporal_functions.cpp to match the new MEOS API. --- src/geo/tgeompoint_functions.cpp | 2 +- src/temporal/temporal_functions.cpp | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/geo/tgeompoint_functions.cpp b/src/geo/tgeompoint_functions.cpp index 02f3fccb..f45241e0 100644 --- a/src/geo/tgeompoint_functions.cpp +++ b/src/geo/tgeompoint_functions.cpp @@ -455,7 +455,7 @@ void TgeompointFunctions::Tgeompoint_sequence_constructor(DataChunk &args, Expre auto arg_count = args.ColumnCount(); auto row_count = args.size(); meosType temptype = TemporalHelpers::GetTemptypeFromAlias(result.GetType().GetAlias().c_str()); - interpType interp = temptype_continuous(temptype) ? LINEAR : STEP; + interpType interp = temptype_supports_linear(temptype) ? LINEAR : STEP; bool lower_inc = true; bool upper_inc = true; diff --git a/src/temporal/temporal_functions.cpp b/src/temporal/temporal_functions.cpp index 7e5cc932..2de53720 100644 --- a/src/temporal/temporal_functions.cpp +++ b/src/temporal/temporal_functions.cpp @@ -244,7 +244,7 @@ void TemporalFunctions::Tsequence_constructor(DataChunk &args, ExpressionState & auto &child_vec = ListVector::GetEntry(array_vec); meosType temptype = TemporalHelpers::GetTemptypeFromAlias(result.GetType().GetAlias().c_str()); - interpType interp = temptype_continuous(temptype) ? LINEAR : STEP; + interpType interp = temptype_supports_linear(temptype) ? LINEAR : STEP; bool lower_inc = true; bool upper_inc = true; @@ -516,7 +516,7 @@ void TemporalFunctions::Tsequence_from_base_tstzspan(DataChunk &args, Expression auto count = args.size(); const auto &arg_type = args.data[0].GetType(); meosType temptype = TemporalHelpers::GetTemptypeFromAlias(result.GetType().GetAlias().c_str()); - interpType interp = temptype_continuous(temptype) ? LINEAR : STEP; + interpType interp = temptype_supports_linear(temptype) ? LINEAR : STEP; if (args.ColumnCount() > 2) { auto &interp_child = args.data[2]; interp_child.Flatten(count); @@ -599,7 +599,7 @@ void TemporalFunctions::Tsequenceset_from_base_tstzspanset(DataChunk &args, Expr auto count = args.size(); const auto &arg_type = args.data[0].GetType(); meosType temptype = TemporalHelpers::GetTemptypeFromAlias(result.GetType().GetAlias().c_str()); - interpType interp = temptype_continuous(temptype) ? LINEAR : STEP; + interpType interp = temptype_supports_linear(temptype) ? LINEAR : STEP; if (args.ColumnCount() > 2) { auto &interp_child = args.data[2]; interp_child.Flatten(count); @@ -2417,7 +2417,7 @@ void TemporalFunctions::Temporal_set_interp(DataChunk &args, ExpressionState &st void TemporalFunctions::Temporal_append_tinstant(DataChunk &args, ExpressionState &state, Vector &result) { auto count = args.size(); meosType temptype = TemporalHelpers::GetTemptypeFromAlias(result.GetType().GetAlias().c_str()); - interpType interp = temptype_continuous(temptype) ? LINEAR : STEP; + interpType interp = temptype_supports_linear(temptype) ? LINEAR : STEP; if (args.ColumnCount() > 2) { auto &interp_child = args.data[2]; interp_child.Flatten(count); From 4d125ffd1a5ff9de8e1a815afbe8a930a6cd325f Mon Sep 17 00:00:00 2001 From: Esteban Zimanyi Date: Thu, 14 May 2026 11:10:45 +0200 Subject: [PATCH 04/13] Update spatial-rel template signatures to MEOS 2-arg API --- src/geo/tgeogpoint_ops.cpp | 24 ++++++++++++------------ src/geo/tgeography_ops.cpp | 24 ++++++++++++------------ src/geo/tgeometry_ops.cpp | 24 ++++++++++++------------ 3 files changed, 36 insertions(+), 36 deletions(-) diff --git a/src/geo/tgeogpoint_ops.cpp b/src/geo/tgeogpoint_ops.cpp index 91136138..73cf4566 100644 --- a/src/geo/tgeogpoint_ops.cpp +++ b/src/geo/tgeogpoint_ops.cpp @@ -251,7 +251,7 @@ inline string_t TemporalToBlob(Vector &result, Temporal *t) { return out; } -template +template void TgeoGeoTempExec(DataChunk &args, ExpressionState &, Vector &result) { BinaryExecutor::ExecuteWithNulls( args.data[0], args.data[1], result, args.size(), @@ -259,14 +259,14 @@ void TgeoGeoTempExec(DataChunk &args, ExpressionState &, Vector &result) { Temporal *t = DecodeTemporalCopy(t_blob); int32 srid = tspatial_srid(t); GSERIALIZED *gs = GeometryToGSerialized(g_blob, srid); - Temporal *r = FN(t, gs, false, false); + Temporal *r = FN(t, gs); free(t); free(gs); if (!r) { mask.SetInvalid(idx); return string_t(); } return TemporalToBlob(result, r); }); } -template +template void GeoTgeoTempExec(DataChunk &args, ExpressionState &, Vector &result) { BinaryExecutor::ExecuteWithNulls( args.data[0], args.data[1], result, args.size(), @@ -274,21 +274,21 @@ void GeoTgeoTempExec(DataChunk &args, ExpressionState &, Vector &result) { Temporal *t = DecodeTemporalCopy(t_blob); int32 srid = tspatial_srid(t); GSERIALIZED *gs = GeometryToGSerialized(g_blob, srid); - Temporal *r = FN(gs, t, false, false); + Temporal *r = FN(gs, t); free(t); free(gs); if (!r) { mask.SetInvalid(idx); return string_t(); } return TemporalToBlob(result, r); }); } -template +template void TgeoTgeoTempExec(DataChunk &args, ExpressionState &, Vector &result) { BinaryExecutor::ExecuteWithNulls( args.data[0], args.data[1], result, args.size(), [&](string_t a, string_t b, ValidityMask &mask, idx_t idx) -> string_t { Temporal *t1 = DecodeTemporalCopy(a); Temporal *t2 = DecodeTemporalCopy(b); - Temporal *r = FN(t1, t2, false, false); + Temporal *r = FN(t1, t2); free(t1); free(t2); if (!r) { mask.SetInvalid(idx); return string_t(); } return TemporalToBlob(result, r); @@ -296,7 +296,7 @@ void TgeoTgeoTempExec(DataChunk &args, ExpressionState &, Vector &result) { } // tDwithin variants take an extra distance argument. -template +template void TgeoGeoDistTempExec(DataChunk &args, ExpressionState &, Vector &result) { TernaryExecutor::ExecuteWithNulls( args.data[0], args.data[1], args.data[2], result, args.size(), @@ -304,14 +304,14 @@ void TgeoGeoDistTempExec(DataChunk &args, ExpressionState &, Vector &result) { Temporal *t = DecodeTemporalCopy(t_blob); int32 srid = tspatial_srid(t); GSERIALIZED *gs = GeometryToGSerialized(g_blob, srid); - Temporal *r = FN(t, gs, dist, false, false); + Temporal *r = FN(t, gs, dist); free(t); free(gs); if (!r) { mask.SetInvalid(idx); return string_t(); } return TemporalToBlob(result, r); }); } -template +template void GeoTgeoDistTempExec(DataChunk &args, ExpressionState &, Vector &result) { TernaryExecutor::ExecuteWithNulls( args.data[0], args.data[1], args.data[2], result, args.size(), @@ -319,21 +319,21 @@ void GeoTgeoDistTempExec(DataChunk &args, ExpressionState &, Vector &result) { Temporal *t = DecodeTemporalCopy(t_blob); int32 srid = tspatial_srid(t); GSERIALIZED *gs = GeometryToGSerialized(g_blob, srid); - Temporal *r = FN(gs, t, dist, false, false); + Temporal *r = FN(gs, t, dist); free(t); free(gs); if (!r) { mask.SetInvalid(idx); return string_t(); } return TemporalToBlob(result, r); }); } -template +template void TgeoTgeoDistTempExec(DataChunk &args, ExpressionState &, Vector &result) { TernaryExecutor::ExecuteWithNulls( args.data[0], args.data[1], args.data[2], result, args.size(), [&](string_t a, string_t b, double dist, ValidityMask &mask, idx_t idx) -> string_t { Temporal *t1 = DecodeTemporalCopy(a); Temporal *t2 = DecodeTemporalCopy(b); - Temporal *r = FN(t1, t2, dist, false, false); + Temporal *r = FN(t1, t2, dist); free(t1); free(t2); if (!r) { mask.SetInvalid(idx); return string_t(); } return TemporalToBlob(result, r); diff --git a/src/geo/tgeography_ops.cpp b/src/geo/tgeography_ops.cpp index 1eee6ed0..af2dac14 100644 --- a/src/geo/tgeography_ops.cpp +++ b/src/geo/tgeography_ops.cpp @@ -252,7 +252,7 @@ inline string_t TemporalToBlob(Vector &result, Temporal *t) { return out; } -template +template void TgeoGeoTempExec(DataChunk &args, ExpressionState &, Vector &result) { BinaryExecutor::ExecuteWithNulls( args.data[0], args.data[1], result, args.size(), @@ -260,14 +260,14 @@ void TgeoGeoTempExec(DataChunk &args, ExpressionState &, Vector &result) { Temporal *t = DecodeTemporalCopy(t_blob); int32 srid = tspatial_srid(t); GSERIALIZED *gs = GeometryToGSerialized(g_blob, srid); - Temporal *r = FN(t, gs, false, false); + Temporal *r = FN(t, gs); free(t); free(gs); if (!r) { mask.SetInvalid(idx); return string_t(); } return TemporalToBlob(result, r); }); } -template +template void GeoTgeoTempExec(DataChunk &args, ExpressionState &, Vector &result) { BinaryExecutor::ExecuteWithNulls( args.data[0], args.data[1], result, args.size(), @@ -275,21 +275,21 @@ void GeoTgeoTempExec(DataChunk &args, ExpressionState &, Vector &result) { Temporal *t = DecodeTemporalCopy(t_blob); int32 srid = tspatial_srid(t); GSERIALIZED *gs = GeometryToGSerialized(g_blob, srid); - Temporal *r = FN(gs, t, false, false); + Temporal *r = FN(gs, t); free(t); free(gs); if (!r) { mask.SetInvalid(idx); return string_t(); } return TemporalToBlob(result, r); }); } -template +template void TgeoTgeoTempExec(DataChunk &args, ExpressionState &, Vector &result) { BinaryExecutor::ExecuteWithNulls( args.data[0], args.data[1], result, args.size(), [&](string_t a, string_t b, ValidityMask &mask, idx_t idx) -> string_t { Temporal *t1 = DecodeTemporalCopy(a); Temporal *t2 = DecodeTemporalCopy(b); - Temporal *r = FN(t1, t2, false, false); + Temporal *r = FN(t1, t2); free(t1); free(t2); if (!r) { mask.SetInvalid(idx); return string_t(); } return TemporalToBlob(result, r); @@ -297,7 +297,7 @@ void TgeoTgeoTempExec(DataChunk &args, ExpressionState &, Vector &result) { } // tDwithin variants take an extra distance argument. -template +template void TgeoGeoDistTempExec(DataChunk &args, ExpressionState &, Vector &result) { TernaryExecutor::ExecuteWithNulls( args.data[0], args.data[1], args.data[2], result, args.size(), @@ -305,14 +305,14 @@ void TgeoGeoDistTempExec(DataChunk &args, ExpressionState &, Vector &result) { Temporal *t = DecodeTemporalCopy(t_blob); int32 srid = tspatial_srid(t); GSERIALIZED *gs = GeometryToGSerialized(g_blob, srid); - Temporal *r = FN(t, gs, dist, false, false); + Temporal *r = FN(t, gs, dist); free(t); free(gs); if (!r) { mask.SetInvalid(idx); return string_t(); } return TemporalToBlob(result, r); }); } -template +template void GeoTgeoDistTempExec(DataChunk &args, ExpressionState &, Vector &result) { TernaryExecutor::ExecuteWithNulls( args.data[0], args.data[1], args.data[2], result, args.size(), @@ -320,21 +320,21 @@ void GeoTgeoDistTempExec(DataChunk &args, ExpressionState &, Vector &result) { Temporal *t = DecodeTemporalCopy(t_blob); int32 srid = tspatial_srid(t); GSERIALIZED *gs = GeometryToGSerialized(g_blob, srid); - Temporal *r = FN(gs, t, dist, false, false); + Temporal *r = FN(gs, t, dist); free(t); free(gs); if (!r) { mask.SetInvalid(idx); return string_t(); } return TemporalToBlob(result, r); }); } -template +template void TgeoTgeoDistTempExec(DataChunk &args, ExpressionState &, Vector &result) { TernaryExecutor::ExecuteWithNulls( args.data[0], args.data[1], args.data[2], result, args.size(), [&](string_t a, string_t b, double dist, ValidityMask &mask, idx_t idx) -> string_t { Temporal *t1 = DecodeTemporalCopy(a); Temporal *t2 = DecodeTemporalCopy(b); - Temporal *r = FN(t1, t2, dist, false, false); + Temporal *r = FN(t1, t2, dist); free(t1); free(t2); if (!r) { mask.SetInvalid(idx); return string_t(); } return TemporalToBlob(result, r); diff --git a/src/geo/tgeometry_ops.cpp b/src/geo/tgeometry_ops.cpp index 2db1613a..d66a936d 100644 --- a/src/geo/tgeometry_ops.cpp +++ b/src/geo/tgeometry_ops.cpp @@ -252,7 +252,7 @@ inline string_t TemporalToBlob(Vector &result, Temporal *t) { return out; } -template +template void TgeoGeoTempExec(DataChunk &args, ExpressionState &, Vector &result) { BinaryExecutor::ExecuteWithNulls( args.data[0], args.data[1], result, args.size(), @@ -260,14 +260,14 @@ void TgeoGeoTempExec(DataChunk &args, ExpressionState &, Vector &result) { Temporal *t = DecodeTemporalCopy(t_blob); int32 srid = tspatial_srid(t); GSERIALIZED *gs = GeometryToGSerialized(g_blob, srid); - Temporal *r = FN(t, gs, false, false); + Temporal *r = FN(t, gs); free(t); free(gs); if (!r) { mask.SetInvalid(idx); return string_t(); } return TemporalToBlob(result, r); }); } -template +template void GeoTgeoTempExec(DataChunk &args, ExpressionState &, Vector &result) { BinaryExecutor::ExecuteWithNulls( args.data[0], args.data[1], result, args.size(), @@ -275,21 +275,21 @@ void GeoTgeoTempExec(DataChunk &args, ExpressionState &, Vector &result) { Temporal *t = DecodeTemporalCopy(t_blob); int32 srid = tspatial_srid(t); GSERIALIZED *gs = GeometryToGSerialized(g_blob, srid); - Temporal *r = FN(gs, t, false, false); + Temporal *r = FN(gs, t); free(t); free(gs); if (!r) { mask.SetInvalid(idx); return string_t(); } return TemporalToBlob(result, r); }); } -template +template void TgeoTgeoTempExec(DataChunk &args, ExpressionState &, Vector &result) { BinaryExecutor::ExecuteWithNulls( args.data[0], args.data[1], result, args.size(), [&](string_t a, string_t b, ValidityMask &mask, idx_t idx) -> string_t { Temporal *t1 = DecodeTemporalCopy(a); Temporal *t2 = DecodeTemporalCopy(b); - Temporal *r = FN(t1, t2, false, false); + Temporal *r = FN(t1, t2); free(t1); free(t2); if (!r) { mask.SetInvalid(idx); return string_t(); } return TemporalToBlob(result, r); @@ -297,7 +297,7 @@ void TgeoTgeoTempExec(DataChunk &args, ExpressionState &, Vector &result) { } // tDwithin variants take an extra distance argument. -template +template void TgeoGeoDistTempExec(DataChunk &args, ExpressionState &, Vector &result) { TernaryExecutor::ExecuteWithNulls( args.data[0], args.data[1], args.data[2], result, args.size(), @@ -305,14 +305,14 @@ void TgeoGeoDistTempExec(DataChunk &args, ExpressionState &, Vector &result) { Temporal *t = DecodeTemporalCopy(t_blob); int32 srid = tspatial_srid(t); GSERIALIZED *gs = GeometryToGSerialized(g_blob, srid); - Temporal *r = FN(t, gs, dist, false, false); + Temporal *r = FN(t, gs, dist); free(t); free(gs); if (!r) { mask.SetInvalid(idx); return string_t(); } return TemporalToBlob(result, r); }); } -template +template void GeoTgeoDistTempExec(DataChunk &args, ExpressionState &, Vector &result) { TernaryExecutor::ExecuteWithNulls( args.data[0], args.data[1], args.data[2], result, args.size(), @@ -320,21 +320,21 @@ void GeoTgeoDistTempExec(DataChunk &args, ExpressionState &, Vector &result) { Temporal *t = DecodeTemporalCopy(t_blob); int32 srid = tspatial_srid(t); GSERIALIZED *gs = GeometryToGSerialized(g_blob, srid); - Temporal *r = FN(gs, t, dist, false, false); + Temporal *r = FN(gs, t, dist); free(t); free(gs); if (!r) { mask.SetInvalid(idx); return string_t(); } return TemporalToBlob(result, r); }); } -template +template void TgeoTgeoDistTempExec(DataChunk &args, ExpressionState &, Vector &result) { TernaryExecutor::ExecuteWithNulls( args.data[0], args.data[1], args.data[2], result, args.size(), [&](string_t a, string_t b, double dist, ValidityMask &mask, idx_t idx) -> string_t { Temporal *t1 = DecodeTemporalCopy(a); Temporal *t2 = DecodeTemporalCopy(b); - Temporal *r = FN(t1, t2, dist, false, false); + Temporal *r = FN(t1, t2, dist); free(t1); free(t2); if (!r) { mask.SetInvalid(idx); return string_t(); } return TemporalToBlob(result, r); From 18ee9d1adee00509b69874893558759751715e0c Mon Sep 17 00:00:00 2001 From: Esteban Zimanyi Date: Thu, 14 May 2026 12:18:37 +0200 Subject: [PATCH 05/13] Update rtree_module to MEOS new bbox_type/MeosArray API Drop trailing underscore on bbox_type and migrate rtree_search to the new MeosArray *result out-parameter signature replacing the int **/int* pair. --- src/include/index/rtree_module.hpp | 4 +-- src/index/rtree_module.cpp | 42 ++++++++++++++---------------- 2 files changed, 22 insertions(+), 24 deletions(-) diff --git a/src/include/index/rtree_module.hpp b/src/include/index/rtree_module.hpp index 5cb45811..1adb584c 100644 --- a/src/include/index/rtree_module.hpp +++ b/src/include/index/rtree_module.hpp @@ -70,7 +70,7 @@ class TRTreeIndex : public BoundIndex { bool TryMatchDistanceFunction(const unique_ptr &expr, vector> &bindings) const; - meosType GetBboxType() const { return bbox_type_; } + meosType GetBboxType() const { return bbox_type; } size_t GetBboxSize() const { return bbox_size_; } @@ -84,7 +84,7 @@ class TRTreeIndex : public BoundIndex { RTree *rtree_; void *boxes; - meosType bbox_type_; + meosType bbox_type; size_t bbox_size_; size_t current_size_ = 0; diff --git a/src/index/rtree_module.cpp b/src/index/rtree_module.cpp index d05e4be8..5997a6b5 100644 --- a/src/index/rtree_module.cpp +++ b/src/index/rtree_module.cpp @@ -50,11 +50,11 @@ TRTreeIndex::TRTreeIndex(const string &name, IndexConstraintType constraint_type auto &type = unbound_expressions[0]->return_type; if (type == StboxType::STBOX()) { - bbox_type_ = T_STBOX; + bbox_type = T_STBOX; bbox_size_ = sizeof(STBox); rtree_ = rtree_create_stbox(); } else if (type == SpanTypes::TSTZSPAN()) { - bbox_type_ = T_TSTZSPAN; + bbox_type = T_TSTZSPAN; bbox_size_ = sizeof(Span); rtree_ = rtree_create_tstzspan(); } else { @@ -250,7 +250,7 @@ void TRTreeIndex::Construct(DataChunk &expression_result, Vector &row_identifier box = malloc(data_size); memcpy(box, data, data_size); - if (bbox_type_ == T_STBOX) { + if (bbox_type == T_STBOX) { STBox *stbox = (STBox*)box; int32_t box_srid = stbox_srid(stbox); if (box_srid != 0) { @@ -303,7 +303,7 @@ unique_ptr TRTreeIndex::InitializeScan(const void* query_blob, s auto state = make_uniq(); - if (operation == "@>" && bbox_type_ == T_TSTZSPAN) { + if (operation == "@>" && bbox_type == T_TSTZSPAN) { if (blob_size != sizeof(timestamp_tz_t)) { throw InvalidInputException("Invalid query box size for @> operation. Expected " + std::to_string(sizeof(timestamp_tz_t)) + @@ -332,7 +332,7 @@ unique_ptr TRTreeIndex::InitializeScan(const void* query_blob, s state->query_box = malloc(blob_size); memcpy(state->query_box, data, blob_size); - if (bbox_type_ == T_STBOX) { + if (bbox_type == T_STBOX) { STBox *stbox = (STBox*)state->query_box; int32_t query_srid = stbox_srid(stbox); if (query_srid != 0) { @@ -348,7 +348,7 @@ unique_ptr TRTreeIndex::InitializeScan(const void* query_blob, s } else { throw InvalidInputException("Unsupported R-Tree operation: " + operation + - " for bbox_type: " + std::to_string(bbox_type_)); + " for bbox_type: " + std::to_string(bbox_type)); } if (rtree_) { @@ -393,26 +393,24 @@ vector TRTreeIndex::Search(const void *query_box, RTreeSearchOp op) const return results; } - int count = 0; - int *ids = nullptr; - + MeosArray *ids = meos_array_create(sizeof(int)); + try { - ids = rtree_search(rtree_, op, query_box, &count); - - if (ids && count > 0) { + int count = rtree_search(rtree_, op, query_box, ids); + + if (count > 0) { results.reserve(count); for (int i = 0; i < count; i++) { - results.push_back(static_cast(ids[i])); + int *id = static_cast(meos_array_get(ids, i)); + results.push_back(static_cast(*id)); } } } catch (...) { fprintf(stderr, "Exception during rtree_search\n"); } - - if (ids) { - free(ids); - } - + + meos_array_destroy(ids); + return results; } //------------------------------------------------------------------------------ @@ -463,9 +461,9 @@ bool TRTreeIndex::TryMatchDistanceFunction(const unique_ptr &expr, unique_ptr TRTreeIndex::MakeFunctionMatcher() const { unordered_set supported_functions; - if (bbox_type_ == T_STBOX) { + if (bbox_type == T_STBOX) { supported_functions = {"&&"}; - } else if (bbox_type_ == T_TSTZSPAN) { + } else if (bbox_type == T_TSTZSPAN) { supported_functions = {"&&", "@>"}; } else { supported_functions = {"&&"}; @@ -477,9 +475,9 @@ unique_ptr TRTreeIndex::MakeFunctionMatcher() const { matcher->policy = SetMatcher::Policy::UNORDERED; LogicalType index_type; - if (bbox_type_ == T_STBOX) { + if (bbox_type == T_STBOX) { index_type = StboxType::STBOX(); - } else if (bbox_type_ == T_TSTZSPAN) { + } else if (bbox_type == T_TSTZSPAN) { index_type = SpanTypes::TSTZSPAN(); } else { index_type = LogicalType::BLOB; From d4a6ff5b7d61c41204520330ff53bc856a73d99f Mon Sep 17 00:00:00 2001 From: Esteban Zimanyi Date: Thu, 14 May 2026 12:42:44 +0200 Subject: [PATCH 06/13] Rename rtree class member to avoid MEOS bbox_type collision MEOS master now exports a global function bool bbox_type(MeosType) in meos_internal.h. Inside TRTreeIndex member functions, unqualified bbox_type resolves to that global function and shadows the class member, producing 'assignment of function' and 'invalid conversion' errors. Rename the member to bbox_meostype throughout the rtree module. --- src/include/index/rtree_module.hpp | 4 ++-- src/index/rtree_module.cpp | 20 ++++++++++---------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/include/index/rtree_module.hpp b/src/include/index/rtree_module.hpp index 1adb584c..0bd14ce5 100644 --- a/src/include/index/rtree_module.hpp +++ b/src/include/index/rtree_module.hpp @@ -70,7 +70,7 @@ class TRTreeIndex : public BoundIndex { bool TryMatchDistanceFunction(const unique_ptr &expr, vector> &bindings) const; - meosType GetBboxType() const { return bbox_type; } + meosType GetBboxType() const { return bbox_meostype; } size_t GetBboxSize() const { return bbox_size_; } @@ -84,7 +84,7 @@ class TRTreeIndex : public BoundIndex { RTree *rtree_; void *boxes; - meosType bbox_type; + meosType bbox_meostype; size_t bbox_size_; size_t current_size_ = 0; diff --git a/src/index/rtree_module.cpp b/src/index/rtree_module.cpp index 5997a6b5..bf6c1d7c 100644 --- a/src/index/rtree_module.cpp +++ b/src/index/rtree_module.cpp @@ -50,11 +50,11 @@ TRTreeIndex::TRTreeIndex(const string &name, IndexConstraintType constraint_type auto &type = unbound_expressions[0]->return_type; if (type == StboxType::STBOX()) { - bbox_type = T_STBOX; + bbox_meostype = T_STBOX; bbox_size_ = sizeof(STBox); rtree_ = rtree_create_stbox(); } else if (type == SpanTypes::TSTZSPAN()) { - bbox_type = T_TSTZSPAN; + bbox_meostype = T_TSTZSPAN; bbox_size_ = sizeof(Span); rtree_ = rtree_create_tstzspan(); } else { @@ -250,7 +250,7 @@ void TRTreeIndex::Construct(DataChunk &expression_result, Vector &row_identifier box = malloc(data_size); memcpy(box, data, data_size); - if (bbox_type == T_STBOX) { + if (bbox_meostype == T_STBOX) { STBox *stbox = (STBox*)box; int32_t box_srid = stbox_srid(stbox); if (box_srid != 0) { @@ -303,7 +303,7 @@ unique_ptr TRTreeIndex::InitializeScan(const void* query_blob, s auto state = make_uniq(); - if (operation == "@>" && bbox_type == T_TSTZSPAN) { + if (operation == "@>" && bbox_meostype == T_TSTZSPAN) { if (blob_size != sizeof(timestamp_tz_t)) { throw InvalidInputException("Invalid query box size for @> operation. Expected " + std::to_string(sizeof(timestamp_tz_t)) + @@ -332,7 +332,7 @@ unique_ptr TRTreeIndex::InitializeScan(const void* query_blob, s state->query_box = malloc(blob_size); memcpy(state->query_box, data, blob_size); - if (bbox_type == T_STBOX) { + if (bbox_meostype == T_STBOX) { STBox *stbox = (STBox*)state->query_box; int32_t query_srid = stbox_srid(stbox); if (query_srid != 0) { @@ -348,7 +348,7 @@ unique_ptr TRTreeIndex::InitializeScan(const void* query_blob, s } else { throw InvalidInputException("Unsupported R-Tree operation: " + operation + - " for bbox_type: " + std::to_string(bbox_type)); + " for bbox_type: " + std::to_string(bbox_meostype)); } if (rtree_) { @@ -461,9 +461,9 @@ bool TRTreeIndex::TryMatchDistanceFunction(const unique_ptr &expr, unique_ptr TRTreeIndex::MakeFunctionMatcher() const { unordered_set supported_functions; - if (bbox_type == T_STBOX) { + if (bbox_meostype == T_STBOX) { supported_functions = {"&&"}; - } else if (bbox_type == T_TSTZSPAN) { + } else if (bbox_meostype == T_TSTZSPAN) { supported_functions = {"&&", "@>"}; } else { supported_functions = {"&&"}; @@ -475,9 +475,9 @@ unique_ptr TRTreeIndex::MakeFunctionMatcher() const { matcher->policy = SetMatcher::Policy::UNORDERED; LogicalType index_type; - if (bbox_type == T_STBOX) { + if (bbox_meostype == T_STBOX) { index_type = StboxType::STBOX(); - } else if (bbox_type == T_TSTZSPAN) { + } else if (bbox_meostype == T_TSTZSPAN) { index_type = SpanTypes::TSTZSPAN(); } else { index_type = LogicalType::BLOB; From 05602e0ec02b5cf61a66df20ab98c6097acedbfa Mon Sep 17 00:00:00 2001 From: Esteban Zimanyi Date: Thu, 14 May 2026 13:09:53 +0200 Subject: [PATCH 07/13] Use MeosType directly in headers (forward-compat alias not always visible) --- src/geo/tgeompoint_functions.cpp | 2 +- src/include/index/rtree_module.hpp | 4 +- src/include/temporal/set.hpp | 2 +- src/include/temporal/span.hpp | 2 +- src/include/temporal/spanset.hpp | 2 +- src/include/temporal/tbox_functions.hpp | 8 +- src/include/temporal/temporal_functions.hpp | 6 +- src/temporal/set.cpp | 8 +- src/temporal/set_functions.cpp | 20 ++--- src/temporal/span.cpp | 4 +- src/temporal/span_functions.cpp | 84 ++++++++++----------- src/temporal/spanset.cpp | 4 +- src/temporal/spanset_functions.cpp | 28 +++---- src/temporal/tbox_functions.cpp | 8 +- src/temporal/temporal.cpp | 6 +- src/temporal/temporal_aggregates.cpp | 4 +- src/temporal/temporal_functions.cpp | 38 +++++----- 17 files changed, 115 insertions(+), 115 deletions(-) diff --git a/src/geo/tgeompoint_functions.cpp b/src/geo/tgeompoint_functions.cpp index f45241e0..d063f23f 100644 --- a/src/geo/tgeompoint_functions.cpp +++ b/src/geo/tgeompoint_functions.cpp @@ -454,7 +454,7 @@ void TgeompointFunctions::Tgeompoint_sequence_constructor(DataChunk &args, Expre auto arg_count = args.ColumnCount(); auto row_count = args.size(); - meosType temptype = TemporalHelpers::GetTemptypeFromAlias(result.GetType().GetAlias().c_str()); + MeosType temptype = TemporalHelpers::GetTemptypeFromAlias(result.GetType().GetAlias().c_str()); interpType interp = temptype_supports_linear(temptype) ? LINEAR : STEP; bool lower_inc = true; bool upper_inc = true; diff --git a/src/include/index/rtree_module.hpp b/src/include/index/rtree_module.hpp index 0bd14ce5..71d34964 100644 --- a/src/include/index/rtree_module.hpp +++ b/src/include/index/rtree_module.hpp @@ -70,7 +70,7 @@ class TRTreeIndex : public BoundIndex { bool TryMatchDistanceFunction(const unique_ptr &expr, vector> &bindings) const; - meosType GetBboxType() const { return bbox_meostype; } + MeosType GetBboxType() const { return bbox_meostype; } size_t GetBboxSize() const { return bbox_size_; } @@ -84,7 +84,7 @@ class TRTreeIndex : public BoundIndex { RTree *rtree_; void *boxes; - meosType bbox_meostype; + MeosType bbox_meostype; size_t bbox_size_; size_t current_size_ = 0; diff --git a/src/include/temporal/set.hpp b/src/include/temporal/set.hpp index ed4b21d0..e7522955 100644 --- a/src/include/temporal/set.hpp +++ b/src/include/temporal/set.hpp @@ -34,7 +34,7 @@ struct SetTypes { }; struct SetTypeMapping { - static meosType GetMeosTypeFromAlias(const std::string &alias); + static MeosType GetMeosTypeFromAlias(const std::string &alias); static LogicalType GetChildType(const LogicalType &type); }; diff --git a/src/include/temporal/span.hpp b/src/include/temporal/span.hpp index 3d137e86..6722aa5e 100644 --- a/src/include/temporal/span.hpp +++ b/src/include/temporal/span.hpp @@ -30,7 +30,7 @@ struct SpanTypes { struct SpanTypeMapping { - static meosType GetMeosTypeFromAlias(const std::string &alias); + static MeosType GetMeosTypeFromAlias(const std::string &alias); static LogicalType GetChildType(const LogicalType &type); }; diff --git a/src/include/temporal/spanset.hpp b/src/include/temporal/spanset.hpp index a47db553..3eb9fbcb 100644 --- a/src/include/temporal/spanset.hpp +++ b/src/include/temporal/spanset.hpp @@ -31,7 +31,7 @@ struct SpansetTypes { }; struct SpansetTypeMapping { - static meosType GetMeosTypeFromAlias(const std::string &alias); + static MeosType GetMeosTypeFromAlias(const std::string &alias); static LogicalType GetChildType(const LogicalType &type); static LogicalType GetBaseType(const LogicalType &type); static LogicalType GetSetType(const LogicalType &type); diff --git a/src/include/temporal/tbox_functions.hpp b/src/include/temporal/tbox_functions.hpp index 9bebb560..8fa41593 100644 --- a/src/include/temporal/tbox_functions.hpp +++ b/src/include/temporal/tbox_functions.hpp @@ -26,13 +26,13 @@ struct TboxFunctions { * Constructor functions ****************************************************/ template - static void NumberTimestamptzToTboxExecutor(Vector &value, Vector &t, meosType basetype, Vector &result, idx_t count); + static void NumberTimestamptzToTboxExecutor(Vector &value, Vector &t, MeosType basetype, Vector &result, idx_t count); static void Number_timestamptz_to_tbox(DataChunk &args, ExpressionState &state, Vector &result); static void Numspan_timestamptz_to_tbox(DataChunk &args, ExpressionState &state, Vector &result); template - static void NumberTstzspanToTboxExecutor(Vector &value, Vector &span_str, meosType basetype, Vector &result, idx_t count); + static void NumberTstzspanToTboxExecutor(Vector &value, Vector &span_str, MeosType basetype, Vector &result, idx_t count); static void Number_tstzspan_to_tbox(DataChunk &args, ExpressionState &state, Vector &result);; static void Numspan_tstzspan_to_tbox(DataChunk &args, ExpressionState &state, Vector &result); @@ -41,7 +41,7 @@ struct TboxFunctions { * Conversion functions + cast functions: [TYPE] -> TBOX ****************************************************/ template - static void NumberToTboxExecutor(Vector &value, meosType basetype, Vector &result, idx_t count); + static void NumberToTboxExecutor(Vector &value, MeosType basetype, Vector &result, idx_t count); static void Number_to_tbox(DataChunk &args, ExpressionState &state, Vector &result); static bool Number_to_tbox_cast(Vector &source, Vector &result, idx_t count, CastParameters ¶meters); @@ -115,7 +115,7 @@ struct TboxFunctions { static void Tbox_shift_scale_time(DataChunk &args, ExpressionState &state, Vector &result); template - static void TboxExpandValueExecutor(Vector &tbox, Vector &value, meosType basetype, Vector &result, idx_t count); + static void TboxExpandValueExecutor(Vector &tbox, Vector &value, MeosType basetype, Vector &result, idx_t count); static void Tbox_expand_value(DataChunk &args, ExpressionState &state, Vector &result); static void Tbox_expand_time(DataChunk &args, ExpressionState &state, Vector &result); diff --git a/src/include/temporal/temporal_functions.hpp b/src/include/temporal/temporal_functions.hpp index 5da7fda4..bbb895c3 100644 --- a/src/include/temporal/temporal_functions.hpp +++ b/src/include/temporal/temporal_functions.hpp @@ -14,11 +14,11 @@ class ExtensionLoader; typedef struct { char *alias; - meosType temptype; + MeosType temptype; } alias_type_struct; struct TemporalHelpers { - static meosType GetTemptypeFromAlias(const char *alias); + static MeosType GetTemptypeFromAlias(const char *alias); static vector TempArrToArray(Temporal **temparr, int32_t count, LogicalType element_type); }; @@ -551,7 +551,7 @@ struct TemporalFunctions { * Workaround functions ****************************************************/ template - static void Temporal_dump_common(DataChunk &args, Vector &result, meosType basetype); + static void Temporal_dump_common(DataChunk &args, Vector &result, MeosType basetype); static void Temporal_dump(DataChunk &args, ExpressionState &state, Vector &result); /* *************************************************** diff --git a/src/temporal/set.cpp b/src/temporal/set.cpp index b803498a..bf185b90 100644 --- a/src/temporal/set.cpp +++ b/src/temporal/set.cpp @@ -60,8 +60,8 @@ const std::vector &SetTypes::AllTypes() { return types; } -meosType SetTypeMapping::GetMeosTypeFromAlias(const std::string &alias) { - static const std::unordered_map alias_to_type = { +MeosType SetTypeMapping::GetMeosTypeFromAlias(const std::string &alias) { + static const std::unordered_map alias_to_type = { {"intset", T_INTSET}, {"bigintset", T_BIGINTSET}, {"floatset", T_FLOATSET}, @@ -815,10 +815,10 @@ void SetTypes::RegisterScalarFunctions(ExtensionLoader &loader) { // --- Unnest --- struct SetUnnestBindData : public TableFunctionData { string_t blob; - meosType set_type; + MeosType set_type; LogicalType return_type; - SetUnnestBindData(string_t blob, meosType set_type, LogicalType return_type) + SetUnnestBindData(string_t blob, MeosType set_type, LogicalType return_type) : blob(std::move(blob)), set_type(set_type), return_type(std::move(return_type)) {} }; diff --git a/src/temporal/set_functions.cpp b/src/temporal/set_functions.cpp index 71407eee..a923401b 100644 --- a/src/temporal/set_functions.cpp +++ b/src/temporal/set_functions.cpp @@ -207,7 +207,7 @@ bool SetFunctions::Text_to_set(Vector &source, Vector &result, idx_t count, Cast result.SetVectorType(VectorType::FLAT_VECTOR); auto target_type = result.GetType(); - meosType set_type = SetTypeMapping::GetMeosTypeFromAlias(target_type.GetAlias()); + MeosType set_type = SetTypeMapping::GetMeosTypeFromAlias(target_type.GetAlias()); UnaryExecutor::Execute( source, result, count, @@ -301,7 +301,7 @@ void SetFunctions::Set_constructor(DataChunk &args, ExpressionState &state, Vect } } - meosType base_type = settype_basetype(meos_type); + MeosType base_type = settype_basetype(meos_type); Set *s = set_make_free(values, (int)length, base_type, true); size_t size = set_mem_size(s); @@ -320,7 +320,7 @@ static inline void Write_set(Vector &result, idx_t row, Set *s) { free(s); } -static inline void Value_to_set_core(Vector &source, Vector &result, idx_t count, meosType base_type) { +static inline void Value_to_set_core(Vector &source, Vector &result, idx_t count, MeosType base_type) { source.Flatten(count); result.SetVectorType(VectorType::FLAT_VECTOR); @@ -409,8 +409,8 @@ static inline void Value_to_set_core(Vector &source, Vector &result, idx_t count bool SetFunctions::Value_to_set_cast(Vector &source, Vector &result, idx_t count, CastParameters ¶meters) { auto target_type = result.GetType(); - meosType set_type = SetTypeMapping::GetMeosTypeFromAlias(target_type.GetAlias()); - meosType base_type = settype_basetype(set_type); + MeosType set_type = SetTypeMapping::GetMeosTypeFromAlias(target_type.GetAlias()); + MeosType base_type = settype_basetype(set_type); Value_to_set_core(source, result, count, base_type); return true; @@ -420,8 +420,8 @@ bool SetFunctions::Value_to_set_cast(Vector &source, Vector &result, idx_t count void SetFunctions::Value_to_set(DataChunk &args, ExpressionState &state, Vector &result) { auto &source = args.data[0]; auto out_type = result.GetType(); - meosType set_type = SetTypeMapping::GetMeosTypeFromAlias(out_type.GetAlias()); - meosType base_type = settype_basetype(set_type); + MeosType set_type = SetTypeMapping::GetMeosTypeFromAlias(out_type.GetAlias()); + MeosType base_type = settype_basetype(set_type); Value_to_set_core(source, result, args.size(), base_type); } @@ -960,7 +960,7 @@ void SetFunctions::Set_values(DataChunk &args, ExpressionState &state, Vector &r void SetFunctions::Numset_shift(DataChunk &args, ExpressionState &state, Vector &result) { auto &set_vec = args.data[0]; auto out_type = result.GetType(); - meosType set_type = SetTypeMapping::GetMeosTypeFromAlias(out_type.GetAlias()); + MeosType set_type = SetTypeMapping::GetMeosTypeFromAlias(out_type.GetAlias()); switch (set_type) { case T_INTSET: { // shift(intset, integer) -> intset @@ -1035,7 +1035,7 @@ void SetFunctions::Tstzset_shift(DataChunk &args, ExpressionState &state, Vector void SetFunctions::Numset_scale(DataChunk &args, ExpressionState &state, Vector &result){ auto &set_vec = args.data[0]; auto out_type = result.GetType(); - meosType set_type = SetTypeMapping::GetMeosTypeFromAlias(out_type.GetAlias()); + MeosType set_type = SetTypeMapping::GetMeosTypeFromAlias(out_type.GetAlias()); switch (set_type) { case T_INTSET: { // scale(intset, integer) -> intset @@ -1113,7 +1113,7 @@ void SetFunctions::Numset_shift_scale(DataChunk &args, ExpressionState &state, V auto &wd_vec = args.data[2]; auto out_type = result.GetType(); - meosType set_type = SetTypeMapping::GetMeosTypeFromAlias(out_type.GetAlias()); + MeosType set_type = SetTypeMapping::GetMeosTypeFromAlias(out_type.GetAlias()); switch (set_type) { case T_INTSET: { // shift_scale(intset, integer, integer) -> intset diff --git a/src/temporal/span.cpp b/src/temporal/span.cpp index 35086fc3..b874625d 100644 --- a/src/temporal/span.cpp +++ b/src/temporal/span.cpp @@ -59,8 +59,8 @@ const std::vector &SpanTypes::AllTypes() { return types; } -meosType SpanTypeMapping::GetMeosTypeFromAlias(const std::string &alias) { - static const std::unordered_map alias_to_type = { +MeosType SpanTypeMapping::GetMeosTypeFromAlias(const std::string &alias) { + static const std::unordered_map alias_to_type = { {"INTSPAN", T_INTSPAN}, {"BIGINTSPAN", T_BIGINTSPAN}, {"FLOATSPAN", T_FLOATSPAN}, diff --git a/src/temporal/span_functions.cpp b/src/temporal/span_functions.cpp index 8c6f5bdb..2f78bacd 100644 --- a/src/temporal/span_functions.cpp +++ b/src/temporal/span_functions.cpp @@ -88,7 +88,7 @@ bool SpanFunctions::Text_to_span(Vector &source, Vector &result, idx_t count, Ca std::string type_alias = result_type.GetAlias(); // Map the alias to the correct MEOS type - meosType target_meos_type = SpanTypeMapping::GetMeosTypeFromAlias(type_alias); + MeosType target_meos_type = SpanTypeMapping::GetMeosTypeFromAlias(type_alias); if (target_meos_type == T_UNKNOWN) { throw InvalidInputException("Unknown span type: " + type_alias); @@ -203,7 +203,7 @@ void SpanFunctions::Span_constructor(DataChunk &args, ExpressionState &state, Ve auto &result_type = result.GetType(); std::string type_alias = result_type.GetAlias(); - meosType target_meos_type = SpanTypeMapping::GetMeosTypeFromAlias(type_alias); + MeosType target_meos_type = SpanTypeMapping::GetMeosTypeFromAlias(type_alias); if (target_meos_type == T_UNKNOWN) { throw InvalidInputException("Unknown span type: " + type_alias); @@ -239,9 +239,9 @@ void SpanFunctions::Span_constructor(DataChunk &args, ExpressionState &state, Ve // --- Span binary constructor --- -static string_t Span_make_blob(Datum lower_dat, Datum upper_dat, bool lower_inc, bool upper_inc, meosType span_type, +static string_t Span_make_blob(Datum lower_dat, Datum upper_dat, bool lower_inc, bool upper_inc, MeosType span_type, Vector &result) { - meosType basetype = spantype_basetype(span_type); + MeosType basetype = spantype_basetype(span_type); Span *span = span_make(lower_dat, upper_dat, lower_inc, upper_inc, basetype); if (span == NULL) { throw InvalidInputException("Failed to create span from bounds"); @@ -260,7 +260,7 @@ void SpanFunctions::Span_binary_constructor(DataChunk &args, ExpressionState &st Vector *args3 = args.ColumnCount() == 4 ? &args.data[3] : nullptr; auto out_type = result.GetType(); - meosType span_type = SpanTypeMapping::GetMeosTypeFromAlias(out_type.GetAlias()); + MeosType span_type = SpanTypeMapping::GetMeosTypeFromAlias(out_type.GetAlias()); const idx_t count = args.size(); switch (span_type) { @@ -369,7 +369,7 @@ static inline void Write_span(Vector &result, idx_t row, Span *s) { free(s); } -static void Value_to_span_core(Vector &source, Vector &result, idx_t count, meosType base_type){ +static void Value_to_span_core(Vector &source, Vector &result, idx_t count, MeosType base_type){ source.Flatten(count); result.SetVectorType(VectorType::FLAT_VECTOR); @@ -440,16 +440,16 @@ static void Value_to_span_core(Vector &source, Vector &result, idx_t count, meos void SpanFunctions::Value_to_span(DataChunk &args, ExpressionState &state, Vector &result) { auto &source = args.data[0]; auto out_type = result.GetType(); - meosType span_type = SpanTypeMapping::GetMeosTypeFromAlias(out_type.GetAlias()); - meosType base_type = spantype_basetype(span_type); + MeosType span_type = SpanTypeMapping::GetMeosTypeFromAlias(out_type.GetAlias()); + MeosType base_type = spantype_basetype(span_type); Value_to_span_core(source, result, args.size(), base_type); } bool SpanFunctions::Value_to_span_cast(Vector &source, Vector &result, idx_t count, CastParameters ¶meters) { - meosType span_type = SpanTypeMapping::GetMeosTypeFromAlias(result.GetType().GetAlias()); - meosType base_type = spantype_basetype(span_type); + MeosType span_type = SpanTypeMapping::GetMeosTypeFromAlias(result.GetType().GetAlias()); + MeosType base_type = spantype_basetype(span_type); Value_to_span_core(source, result, count, base_type); return true; } @@ -1054,7 +1054,7 @@ void SpanFunctions::Tstzspan_duration(DataChunk &args, ExpressionState &state, V }); } -static inline string_t Numspan_expand_common(const string_t &blob, Datum value, meosType validate_span_type, Vector &result) { +static inline string_t Numspan_expand_common(const string_t &blob, Datum value, MeosType validate_span_type, Vector &result) { const uint8_t *data = (const uint8_t *)blob.GetData(); size_t size = blob.GetSize(); @@ -1100,7 +1100,7 @@ static inline string_t Tstzspan_expand_common(const string_t &blob, interval_t d void SpanFunctions::Numspan_expand(DataChunk &args, ExpressionState &state, Vector &result) { auto &span_vec = args.data[0]; auto out_type = result.GetType(); - meosType span_type = SpanTypeMapping::GetMeosTypeFromAlias(out_type.GetAlias()); + MeosType span_type = SpanTypeMapping::GetMeosTypeFromAlias(out_type.GetAlias()); switch (span_type) { case T_INTSPAN: { // expand(intspan, integer) -> intspan @@ -1146,7 +1146,7 @@ void SpanFunctions::Numspan_expand(DataChunk &args, ExpressionState &state, Vect void SpanFunctions::Tstzspan_expand(DataChunk &args, ExpressionState &state, Vector &result) { auto &span_vec = args.data[0]; auto out_type = result.GetType(); - meosType span_type = SpanTypeMapping::GetMeosTypeFromAlias(out_type.GetAlias()); + MeosType span_type = SpanTypeMapping::GetMeosTypeFromAlias(out_type.GetAlias()); BinaryExecutor::Execute( span_vec, args.data[1], result, args.size(), [&](string_t blob, interval_t value) -> string_t { @@ -1158,7 +1158,7 @@ void SpanFunctions::Tstzspan_expand(DataChunk &args, ExpressionState &state, Vec } static inline string_t Numspan_shift_common(const string_t &blob, Datum shift_datum, - meosType validate_span_type, Vector &result) { + MeosType validate_span_type, Vector &result) { const uint8_t *data = (const uint8_t *)blob.GetData(); size_t size = blob.GetSize(); @@ -1206,7 +1206,7 @@ static inline string_t Tstzspan_shift_common(const string_t &blob, interval_t du void SpanFunctions::Numspan_shift(DataChunk &args, ExpressionState &state, Vector &result) { auto &span_vec = args.data[0]; auto out_type = result.GetType(); - meosType span_type = SpanTypeMapping::GetMeosTypeFromAlias(out_type.GetAlias()); + MeosType span_type = SpanTypeMapping::GetMeosTypeFromAlias(out_type.GetAlias()); switch (span_type) { case T_INTSPAN: { // shift(intspan, integer) -> intspan @@ -1249,7 +1249,7 @@ void SpanFunctions::Numspan_shift(DataChunk &args, ExpressionState &state, Vecto void SpanFunctions::Tstzspan_shift(DataChunk &args, ExpressionState &state, Vector &result) { auto &span_vec = args.data[0]; auto out_type = result.GetType(); - meosType span_type = SpanTypeMapping::GetMeosTypeFromAlias(out_type.GetAlias()); + MeosType span_type = SpanTypeMapping::GetMeosTypeFromAlias(out_type.GetAlias()); BinaryExecutor::Execute( span_vec, args.data[1], result, args.size(), [&](string_t blob, interval_t shift_interval) -> string_t { @@ -1261,7 +1261,7 @@ void SpanFunctions::Tstzspan_shift(DataChunk &args, ExpressionState &state, Vect } static inline string_t Numspan_scale_common(const string_t &blob, Datum scale_datum, - meosType validate_span_type, Vector &result) { + MeosType validate_span_type, Vector &result) { const uint8_t *data = (const uint8_t *)blob.GetData(); size_t size = blob.GetSize(); @@ -1288,7 +1288,7 @@ static inline string_t Numspan_scale_common(const string_t &blob, Datum scale_da void SpanFunctions::Numspan_scale(DataChunk &args, ExpressionState &state, Vector &result) { auto &span_vec = args.data[0]; auto out_type = result.GetType(); - meosType span_type = SpanTypeMapping::GetMeosTypeFromAlias(out_type.GetAlias()); + MeosType span_type = SpanTypeMapping::GetMeosTypeFromAlias(out_type.GetAlias()); switch (span_type) { case T_INTSPAN: { // scale(intspan, integer) -> intspan @@ -1351,7 +1351,7 @@ static inline string_t Tstzspan_scale_common(const string_t &blob, interval_t du void SpanFunctions::Tstzspan_scale(DataChunk &args, ExpressionState &state, Vector &result) { auto &span_vec = args.data[0]; auto out_type = result.GetType(); - meosType span_type = SpanTypeMapping::GetMeosTypeFromAlias(out_type.GetAlias()); + MeosType span_type = SpanTypeMapping::GetMeosTypeFromAlias(out_type.GetAlias()); BinaryExecutor::Execute( span_vec, args.data[1], result, args.size(), [&](string_t blob, interval_t scale_interval) -> string_t { @@ -1386,7 +1386,7 @@ static inline string_t Tstzspan_shift_scale_common(const string_t &blob, interva } static inline string_t Numspan_shift_scale_common(const string_t &blob, Datum shift_datum, Datum scale_datum, - meosType validate_span_type, Vector &result) { + MeosType validate_span_type, Vector &result) { const uint8_t *data = (const uint8_t *)blob.GetData(); size_t size = blob.GetSize(); @@ -1423,7 +1423,7 @@ static inline string_t Numspan_shift_scale_common(const string_t &blob, Datum sh void SpanFunctions::Numspan_shift_scale(DataChunk &args, ExpressionState &state, Vector &result) { auto &span_vec = args.data[0]; auto out_type = result.GetType(); - meosType span_type = SpanTypeMapping::GetMeosTypeFromAlias(out_type.GetAlias()); + MeosType span_type = SpanTypeMapping::GetMeosTypeFromAlias(out_type.GetAlias()); switch (span_type) { case T_INTSPAN: { @@ -1863,7 +1863,7 @@ void SpanFunctions::Span_cmp(DataChunk &args, ExpressionState &state, Vector &re // --- OPERATOR: span @> value --- void SpanFunctions::Contains_span_value(DataChunk &args, ExpressionState &state, Vector &result) { auto &span_vec = args.data[0]; - meosType span_type = SpanTypeMapping::GetMeosTypeFromAlias(span_vec.GetType().GetAlias()); + MeosType span_type = SpanTypeMapping::GetMeosTypeFromAlias(span_vec.GetType().GetAlias()); switch (span_type){ case T_INTSPAN: { // intspan @> integer @@ -2009,7 +2009,7 @@ void SpanFunctions::Contains_span_span(DataChunk &args, ExpressionState &state, // --- OPERATOR: value <@ span --- void SpanFunctions::Contained_value_span(DataChunk &args, ExpressionState &state, Vector &result) { auto &span_vec = args.data[1]; - meosType span_type = SpanTypeMapping::GetMeosTypeFromAlias(span_vec.GetType().GetAlias()); + MeosType span_type = SpanTypeMapping::GetMeosTypeFromAlias(span_vec.GetType().GetAlias()); switch (span_type){ case T_INTSPAN: { // integer <@ intspan @@ -2194,7 +2194,7 @@ void SpanFunctions::Overlaps_span_span(DataChunk &args, ExpressionState &state, // --- OPERATOR: value -|- span--- void SpanFunctions::Adjacent_value_span(DataChunk &args, ExpressionState &state, Vector &result) { auto &span_vec = args.data[1]; - meosType span_type = SpanTypeMapping::GetMeosTypeFromAlias(span_vec.GetType().GetAlias()); + MeosType span_type = SpanTypeMapping::GetMeosTypeFromAlias(span_vec.GetType().GetAlias()); switch (span_type){ case T_INTSPAN: { // integer -|- intspan @@ -2306,7 +2306,7 @@ void SpanFunctions::Adjacent_value_span(DataChunk &args, ExpressionState &state, // --- OPERATOR: span -|- value --- void SpanFunctions::Adjacent_span_value(DataChunk &args, ExpressionState &state, Vector &result) { auto &span_vec = args.data[0]; - meosType span_type = SpanTypeMapping::GetMeosTypeFromAlias(span_vec.GetType().GetAlias()); + MeosType span_type = SpanTypeMapping::GetMeosTypeFromAlias(span_vec.GetType().GetAlias()); switch (span_type){ case T_INTSPAN: { // intspan -|- integer @@ -2454,7 +2454,7 @@ void SpanFunctions::Adjacent_span_span(DataChunk &args, ExpressionState &state, // --- OPERATOR: value << span --- void SpanFunctions::Left_value_span(DataChunk &args, ExpressionState &state, Vector &result) { auto &span_vec = args.data[1]; - meosType span_type = SpanTypeMapping::GetMeosTypeFromAlias(span_vec.GetType().GetAlias()); + MeosType span_type = SpanTypeMapping::GetMeosTypeFromAlias(span_vec.GetType().GetAlias()); switch (span_type){ case T_INTSPAN: { // integer << intspan @@ -2565,7 +2565,7 @@ void SpanFunctions::Left_value_span(DataChunk &args, ExpressionState &state, Vec // --- OPERATOR: span << value --- void SpanFunctions::Left_span_value(DataChunk &args, ExpressionState &state, Vector &result) { auto &span_vec = args.data[0]; - meosType span_type = SpanTypeMapping::GetMeosTypeFromAlias(span_vec.GetType().GetAlias()); + MeosType span_type = SpanTypeMapping::GetMeosTypeFromAlias(span_vec.GetType().GetAlias()); switch (span_type){ case T_INTSPAN: { // intspan << integer @@ -2709,7 +2709,7 @@ void SpanFunctions::Left_span_span(DataChunk &args, ExpressionState &state, Vect // --- OPERATOR: value >> span --- void SpanFunctions::Right_value_span(DataChunk &args, ExpressionState &state, Vector &result) { auto &span_vec = args.data[1]; - meosType span_type = SpanTypeMapping::GetMeosTypeFromAlias(span_vec.GetType().GetAlias()); + MeosType span_type = SpanTypeMapping::GetMeosTypeFromAlias(span_vec.GetType().GetAlias()); switch (span_type){ case T_INTSPAN: { // integer >> intspan @@ -2820,7 +2820,7 @@ void SpanFunctions::Right_value_span(DataChunk &args, ExpressionState &state, Ve // --- OPERATOR: span >> value --- void SpanFunctions::Right_span_value(DataChunk &args, ExpressionState &state, Vector &result) { auto &span_vec = args.data[0]; - meosType span_type = SpanTypeMapping::GetMeosTypeFromAlias(span_vec.GetType().GetAlias()); + MeosType span_type = SpanTypeMapping::GetMeosTypeFromAlias(span_vec.GetType().GetAlias()); switch (span_type){ case T_INTSPAN: { // intspan >> integer BinaryExecutor::Execute( @@ -2964,7 +2964,7 @@ void SpanFunctions::Right_span_span(DataChunk &args, ExpressionState &state, Vec // ---OPERATOR: value &< span --- void SpanFunctions::Overleft_value_span(DataChunk &args, ExpressionState &state, Vector &result) { auto &span_vec = args.data[1]; - meosType span_type = SpanTypeMapping::GetMeosTypeFromAlias(span_vec.GetType().GetAlias()); + MeosType span_type = SpanTypeMapping::GetMeosTypeFromAlias(span_vec.GetType().GetAlias()); switch (span_type){ case T_INTSPAN: { // integer &< intspan @@ -3075,7 +3075,7 @@ void SpanFunctions::Overleft_value_span(DataChunk &args, ExpressionState &state, // ---OPERATOR: span &< value --- void SpanFunctions::Overleft_span_value(DataChunk &args, ExpressionState &state, Vector &result) { auto &span_vec = args.data[0]; - meosType span_type = SpanTypeMapping::GetMeosTypeFromAlias(span_vec.GetType().GetAlias()); + MeosType span_type = SpanTypeMapping::GetMeosTypeFromAlias(span_vec.GetType().GetAlias()); switch (span_type){ case T_INTSPAN: { // intspan &< integer BinaryExecutor::Execute( @@ -3220,7 +3220,7 @@ void SpanFunctions::Overleft_span_span(DataChunk &args, ExpressionState &state, // --- OPERATOR: value &> span --- void SpanFunctions::Overright_value_span(DataChunk &args, ExpressionState &state, Vector &result) { auto &span_vec = args.data[1]; - meosType span_type = SpanTypeMapping::GetMeosTypeFromAlias(span_vec.GetType().GetAlias()); + MeosType span_type = SpanTypeMapping::GetMeosTypeFromAlias(span_vec.GetType().GetAlias()); switch (span_type){ case T_INTSPAN: { // integer &> intspan BinaryExecutor::Execute( @@ -3331,7 +3331,7 @@ void SpanFunctions::Overright_value_span(DataChunk &args, ExpressionState &state // --- OPERATOR: span &> value --- void SpanFunctions::Overright_span_value(DataChunk &args, ExpressionState &state, Vector &result) { auto &span_vec = args.data[0]; - meosType span_type = SpanTypeMapping::GetMeosTypeFromAlias(span_vec.GetType().GetAlias()); + MeosType span_type = SpanTypeMapping::GetMeosTypeFromAlias(span_vec.GetType().GetAlias()); switch (span_type){ case T_INTSPAN: { // intspan &> integer BinaryExecutor::Execute( @@ -3476,7 +3476,7 @@ void SpanFunctions::Overright_span_span(DataChunk &args, ExpressionState &state, // --- SET OPERATOR --- void SpanFunctions::Union_value_span(DataChunk &args, ExpressionState &state, Vector &result) { auto &span_vec = args.data[1]; - meosType span_type = SpanTypeMapping::GetMeosTypeFromAlias(span_vec.GetType().GetAlias()); + MeosType span_type = SpanTypeMapping::GetMeosTypeFromAlias(span_vec.GetType().GetAlias()); switch (span_type){ case T_INTSPAN: { // integer + intspan BinaryExecutor::Execute( @@ -3621,7 +3621,7 @@ void SpanFunctions::Union_value_span(DataChunk &args, ExpressionState &state, Ve void SpanFunctions::Union_span_value(DataChunk &args, ExpressionState &state, Vector &result) { auto &span_vec = args.data[0]; - meosType span_type = SpanTypeMapping::GetMeosTypeFromAlias(span_vec.GetType().GetAlias()); + MeosType span_type = SpanTypeMapping::GetMeosTypeFromAlias(span_vec.GetType().GetAlias()); switch (span_type){ case T_INTSPAN: { // intspan + integer BinaryExecutor::Execute( @@ -3802,7 +3802,7 @@ void SpanFunctions::Union_span_span(DataChunk &args, ExpressionState &state, Vec // --- OPERATOR: INTERSECTION --- void SpanFunctions::Intersection_value_span(DataChunk &args, ExpressionState &state, Vector &result) { auto &span_vec = args.data[1]; - meosType span_type = SpanTypeMapping::GetMeosTypeFromAlias(span_vec.GetType().GetAlias()); + MeosType span_type = SpanTypeMapping::GetMeosTypeFromAlias(span_vec.GetType().GetAlias()); switch (span_type){ case T_INTSPAN: { // integer * intspan BinaryExecutor::Execute( @@ -3967,7 +3967,7 @@ void SpanFunctions::Intersection_value_span(DataChunk &args, ExpressionState &st void SpanFunctions::Intersection_span_value(DataChunk &args, ExpressionState &state, Vector &result) { auto &span_vec = args.data[0]; - meosType span_type = SpanTypeMapping::GetMeosTypeFromAlias(span_vec.GetType().GetAlias()); + MeosType span_type = SpanTypeMapping::GetMeosTypeFromAlias(span_vec.GetType().GetAlias()); switch (span_type){ case T_INTSPAN: { // intspan * integer BinaryExecutor::Execute( @@ -4182,7 +4182,7 @@ void SpanFunctions::Intersection_span_span(DataChunk &args, ExpressionState &sta // --- OPERATOR: MINUS --- void SpanFunctions::Minus_value_span(DataChunk &args, ExpressionState &state, Vector &result) { auto &span_vec = args.data[1]; - meosType span_type = SpanTypeMapping::GetMeosTypeFromAlias(span_vec.GetType().GetAlias()); + MeosType span_type = SpanTypeMapping::GetMeosTypeFromAlias(span_vec.GetType().GetAlias()); switch (span_type){ case T_INTSPAN: { // integer - intspan BinaryExecutor::Execute( @@ -4347,7 +4347,7 @@ void SpanFunctions::Minus_value_span(DataChunk &args, ExpressionState &state, Ve void SpanFunctions::Minus_span_value(DataChunk &args, ExpressionState &state, Vector &result) { auto &span_vec = args.data[0]; - meosType span_type = SpanTypeMapping::GetMeosTypeFromAlias(span_vec.GetType().GetAlias()); + MeosType span_type = SpanTypeMapping::GetMeosTypeFromAlias(span_vec.GetType().GetAlias()); switch (span_type){ case T_INTSPAN: { // intspan - integer BinaryExecutor::Execute( @@ -4562,7 +4562,7 @@ void SpanFunctions::Minus_span_span(DataChunk &args, ExpressionState &state, Vec //--- DISTANCE FUNCTIONS --- void SpanFunctions::Distance_span_value(DataChunk &args, ExpressionState &state, Vector &result) { auto &span_vec = args.data[0]; - meosType span_type = SpanTypeMapping::GetMeosTypeFromAlias(span_vec.GetType().GetAlias()); + MeosType span_type = SpanTypeMapping::GetMeosTypeFromAlias(span_vec.GetType().GetAlias()); switch (span_type){ case T_INTSPAN: { // distance between intspan and integer BinaryExecutor::Execute( @@ -4673,7 +4673,7 @@ void SpanFunctions::Distance_span_value(DataChunk &args, ExpressionState &state, void SpanFunctions::Distance_value_span(DataChunk &args, ExpressionState &state, Vector &result) { auto &span_vec = args.data[1]; - meosType span_type = SpanTypeMapping::GetMeosTypeFromAlias(span_vec.GetType().GetAlias()); + MeosType span_type = SpanTypeMapping::GetMeosTypeFromAlias(span_vec.GetType().GetAlias()); switch (span_type){ case T_INTSPAN: { // distance between integer and intspan BinaryExecutor::Execute( @@ -4783,7 +4783,7 @@ void SpanFunctions::Distance_value_span(DataChunk &args, ExpressionState &state, void SpanFunctions::Distance_span_span(DataChunk &args, ExpressionState &state, Vector &result) { auto &span1_vec = args.data[0]; - meosType span_type = SpanTypeMapping::GetMeosTypeFromAlias(span1_vec.GetType().GetAlias()); + MeosType span_type = SpanTypeMapping::GetMeosTypeFromAlias(span1_vec.GetType().GetAlias()); if (span_type == T_TSTZSPAN) { BinaryExecutor::ExecuteWithNulls( diff --git a/src/temporal/spanset.cpp b/src/temporal/spanset.cpp index dd3e42c0..5c38c8e4 100644 --- a/src/temporal/spanset.cpp +++ b/src/temporal/spanset.cpp @@ -53,8 +53,8 @@ const std::vector &SpansetTypes::AllTypes() { return types; } -meosType SpansetTypeMapping::GetMeosTypeFromAlias(const std::string &alias) { - static const std::unordered_map alias_to_type = { +MeosType SpansetTypeMapping::GetMeosTypeFromAlias(const std::string &alias) { + static const std::unordered_map alias_to_type = { {"intspanset", T_INTSPANSET}, {"bigintspanset", T_BIGINTSPANSET}, {"floatspanset", T_FLOATSPANSET}, diff --git a/src/temporal/spanset_functions.cpp b/src/temporal/spanset_functions.cpp index 4010f4d9..5c88b75c 100644 --- a/src/temporal/spanset_functions.cpp +++ b/src/temporal/spanset_functions.cpp @@ -160,7 +160,7 @@ bool SpansetFunctions::Text_to_spanset(Vector &source, Vector &result, idx_t cou result.SetVectorType(VectorType::FLAT_VECTOR); auto target_type = result.GetType(); - meosType spanset_type = SpansetTypeMapping::GetMeosTypeFromAlias(target_type.GetAlias()); + MeosType spanset_type = SpansetTypeMapping::GetMeosTypeFromAlias(target_type.GetAlias()); UnaryExecutor::Execute( source, result, count, @@ -226,7 +226,7 @@ static inline void Write_spanset(Vector &result, idx_t row, SpanSet *s) { free(s); } -static inline void Value_to_spanset_core(Vector &source, Vector &result, idx_t count, meosType base_type) { +static inline void Value_to_spanset_core(Vector &source, Vector &result, idx_t count, MeosType base_type) { source.Flatten(count); result.SetVectorType(VectorType::FLAT_VECTOR); @@ -288,9 +288,9 @@ static inline void Value_to_spanset_core(Vector &source, Vector &result, idx_t c // --- CAST (conversion: base -> spanset) ---- bool SpansetFunctions::Value_to_spanset_cast(Vector &source, Vector &result, idx_t count, CastParameters ¶meters) { auto target_type = result.GetType(); - meosType spanset_t = SpansetTypeMapping::GetMeosTypeFromAlias(target_type.GetAlias()); - meosType span_t = spansettype_spantype(spanset_t); - meosType base_t = spantype_basetype(span_t); + MeosType spanset_t = SpansetTypeMapping::GetMeosTypeFromAlias(target_type.GetAlias()); + MeosType span_t = spansettype_spantype(spanset_t); + MeosType base_t = spantype_basetype(span_t); Value_to_spanset_core(source, result, count, base_t); return true; @@ -300,9 +300,9 @@ bool SpansetFunctions::Value_to_spanset_cast(Vector &source, Vector &result, idx void SpansetFunctions::Value_to_spanset(DataChunk &args, ExpressionState &state, Vector &result) { auto &source = args.data[0]; auto out_type = result.GetType(); - meosType spanset_t= SpansetTypeMapping::GetMeosTypeFromAlias(out_type.GetAlias()); - meosType span_t = spansettype_spantype(spanset_t); - meosType base_t = spantype_basetype(span_t); + MeosType spanset_t= SpansetTypeMapping::GetMeosTypeFromAlias(out_type.GetAlias()); + MeosType span_t = spansettype_spantype(spanset_t); + MeosType base_t = spantype_basetype(span_t); Value_to_spanset_core(source, result, args.size(), base_t); } @@ -1161,7 +1161,7 @@ void SpansetFunctions::Tstzspanset_timestamps(DataChunk &args, ExpressionState & } static inline string_t Numspanset_shift_common(const string_t &blob, Datum shift_datum, - meosType validate_spanset_type, Vector &result) { + MeosType validate_spanset_type, Vector &result) { const uint8_t *data = (const uint8_t *)blob.GetData(); size_t size = blob.GetSize(); @@ -1208,7 +1208,7 @@ static inline string_t Tstzspanset_shift_common(const string_t &blob, interval_t void SpansetFunctions::Numspanset_shift(DataChunk &args, ExpressionState &state, Vector &result) { auto &spanset_vec = args.data[0]; auto out_type = result.GetType(); - meosType spanset_type = SpansetTypeMapping::GetMeosTypeFromAlias(out_type.GetAlias()); + MeosType spanset_type = SpansetTypeMapping::GetMeosTypeFromAlias(out_type.GetAlias()); switch (spanset_type) { case T_INTSPANSET: { // shift(intspanset, integer) -> intspanset @@ -1262,7 +1262,7 @@ void SpansetFunctions::Tstzspanset_shift(DataChunk &args, ExpressionState &state } static inline string_t Numspanset_scale_common(const string_t &blob, Datum scale_datum, - meosType validate_spanset_type, Vector &result) { + MeosType validate_spanset_type, Vector &result) { const uint8_t *data = (const uint8_t *)blob.GetData(); size_t size = blob.GetSize(); @@ -1289,7 +1289,7 @@ static inline string_t Numspanset_scale_common(const string_t &blob, Datum scale void SpansetFunctions::Numspanset_scale(DataChunk &args, ExpressionState &state, Vector &result) { auto &spanset_vec = args.data[0]; auto out_type = result.GetType(); - meosType spanset_type = SpansetTypeMapping::GetMeosTypeFromAlias(out_type.GetAlias()); + MeosType spanset_type = SpansetTypeMapping::GetMeosTypeFromAlias(out_type.GetAlias()); switch (spanset_type) { case T_INTSPANSET: { // scale(intspanset, integer) -> intspanset @@ -1386,7 +1386,7 @@ static inline string_t Tstzspanset_shift_scale_common(const string_t &blob, inte } static inline string_t Numspanset_shift_scale_common(const string_t &blob, Datum shift_datum, Datum scale_datum, - meosType validate_spanset_type, Vector &result) { + MeosType validate_spanset_type, Vector &result) { const uint8_t *data = (const uint8_t *)blob.GetData(); size_t size = blob.GetSize(); @@ -1423,7 +1423,7 @@ static inline string_t Numspanset_shift_scale_common(const string_t &blob, Datum void SpansetFunctions::Numspanset_shift_scale(DataChunk &args, ExpressionState &state, Vector &result) { auto &spanset_vec = args.data[0]; auto out_type = result.GetType(); - meosType spanset_type = SpanTypeMapping::GetMeosTypeFromAlias(out_type.GetAlias()); + MeosType spanset_type = SpanTypeMapping::GetMeosTypeFromAlias(out_type.GetAlias()); switch (spanset_type) { case T_INTSPANSET: { diff --git a/src/temporal/tbox_functions.cpp b/src/temporal/tbox_functions.cpp index fd17bacf..7507bc61 100644 --- a/src/temporal/tbox_functions.cpp +++ b/src/temporal/tbox_functions.cpp @@ -84,7 +84,7 @@ bool TboxFunctions::Tbox_out(Vector &source, Vector &result, idx_t count, CastPa } template -void TboxFunctions::NumberTimestamptzToTboxExecutor(Vector &value, Vector &t, meosType basetype, Vector &result, idx_t count) { +void TboxFunctions::NumberTimestamptzToTboxExecutor(Vector &value, Vector &t, MeosType basetype, Vector &result, idx_t count) { BinaryExecutor::Execute( value, t, result, count, [&](TA value, timestamp_tz_t t) { @@ -150,7 +150,7 @@ void TboxFunctions::Numspan_timestamptz_to_tbox(DataChunk &args, ExpressionState } template -void TboxFunctions::NumberTstzspanToTboxExecutor(Vector &value, Vector &span_str, meosType basetype, Vector &result, idx_t count) { +void TboxFunctions::NumberTstzspanToTboxExecutor(Vector &value, Vector &span_str, MeosType basetype, Vector &result, idx_t count) { BinaryExecutor::Execute( value, span_str, result, count, [&](TA value, string_t span_str) { @@ -234,7 +234,7 @@ void TboxFunctions::Numspan_tstzspan_to_tbox(DataChunk &args, ExpressionState &s } template -void TboxFunctions::NumberToTboxExecutor(Vector &value, meosType basetype, Vector &result, idx_t count) { +void TboxFunctions::NumberToTboxExecutor(Vector &value, MeosType basetype, Vector &result, idx_t count) { UnaryExecutor::Execute( value, result, count, [&](TA value) { @@ -1007,7 +1007,7 @@ void TboxFunctions::Tbox_shift_scale_time(DataChunk &args, ExpressionState &stat } template -void TboxFunctions::TboxExpandValueExecutor(Vector &tbox, Vector &value, meosType basetype, Vector &result, idx_t count) { +void TboxFunctions::TboxExpandValueExecutor(Vector &tbox, Vector &value, MeosType basetype, Vector &result, idx_t count) { BinaryExecutor::ExecuteWithNulls( tbox, value, result, count, [&](string_t tbox_str, TB value, ValidityMask &mask, idx_t idx) { diff --git a/src/temporal/temporal.cpp b/src/temporal/temporal.cpp index 108210bb..7a64b498 100644 --- a/src/temporal/temporal.cpp +++ b/src/temporal/temporal.cpp @@ -1904,10 +1904,10 @@ void TemporalTypes::RegisterScalarFunctions(ExtensionLoader &loader) { struct TemporalUnnestBindData : public TableFunctionData { string_t blob; - meosType temptype; + MeosType temptype; LogicalType returnType; - TemporalUnnestBindData(string_t blob, meosType temptype, LogicalType returnType) + TemporalUnnestBindData(string_t blob, MeosType temptype, LogicalType returnType) : blob(std::move(blob)), temptype(temptype), returnType(std::move(returnType)) {} }; @@ -2828,7 +2828,7 @@ void TemporalTypes::RegisterTemporalTileSplit(ExtensionLoader &loader) { struct TnumberValueSplitBindData : public TableFunctionData { string_t blob; - meosType temptype; + MeosType temptype; LogicalType base_type; // BIGINT for tint, DOUBLE for tfloat LogicalType temporal_type; // TINT or TFLOAT double size; diff --git a/src/temporal/temporal_aggregates.cpp b/src/temporal/temporal_aggregates.cpp index aa933666..2053b098 100644 --- a/src/temporal/temporal_aggregates.cpp +++ b/src/temporal/temporal_aggregates.cpp @@ -835,7 +835,7 @@ struct SetUnionFromSetFn { }; // SetUnionAgg() — input is a primitive value lifted to a Datum. -template +template struct SetUnionFromScalarFn { template static void Initialize(STATE &state) { state.value = nullptr; } @@ -893,7 +893,7 @@ static AggregateFunction MakeSetAggregate(const LogicalType &input_type, const L SetAggState, string_t, string_t, OP, AggregateDestructorType::LEGACY>(input_type, return_type); } -template +template static AggregateFunction MakeSetUnionScalarAggregate(const LogicalType &input_type, const LogicalType &return_type) { return AggregateFunction::UnaryAggregateDestructor< diff --git a/src/temporal/temporal_functions.cpp b/src/temporal/temporal_functions.cpp index 2de53720..48e61ed2 100644 --- a/src/temporal/temporal_functions.cpp +++ b/src/temporal/temporal_functions.cpp @@ -27,7 +27,7 @@ static const alias_type_struct DUCKDB_ALIAS_TYPE_CATALOG[] = { {(char*)"TGEOMETRY", T_TGEOMETRY} }; -meosType TemporalHelpers::GetTemptypeFromAlias(const char *alias) { +MeosType TemporalHelpers::GetTemptypeFromAlias(const char *alias) { for (size_t i = 0; i < sizeof(DUCKDB_ALIAS_TYPE_CATALOG) / sizeof(DUCKDB_ALIAS_TYPE_CATALOG[0]); i++) { if (strcmp(alias, DUCKDB_ALIAS_TYPE_CATALOG[i].alias) == 0) { return DUCKDB_ALIAS_TYPE_CATALOG[i].temptype; @@ -56,7 +56,7 @@ vector TemporalHelpers::TempArrToArray(Temporal **temparr, int32_t count, bool TemporalFunctions::Temporal_in(Vector &source, Vector &result, idx_t count, CastParameters ¶meters) { auto &target_type = result.GetType(); - meosType temptype = TemporalHelpers::GetTemptypeFromAlias(target_type.GetAlias().c_str()); + MeosType temptype = TemporalHelpers::GetTemptypeFromAlias(target_type.GetAlias().c_str()); bool success = true; UnaryExecutor::ExecuteWithNulls( source, result, count, @@ -163,7 +163,7 @@ void TemporalFunctions::Tinstant_constructor_common(Vector &value, Vector &ts, V BinaryExecutor::Execute( value, ts, result, count, [&](T value, timestamp_tz_t ts) { - meosType temptype = TemporalHelpers::GetTemptypeFromAlias(result.GetType().GetAlias().c_str()); + MeosType temptype = TemporalHelpers::GetTemptypeFromAlias(result.GetType().GetAlias().c_str()); timestamp_tz_t meos_ts = DuckDBToMeosTimestamp(ts); Datum datum; @@ -195,7 +195,7 @@ void TemporalFunctions::Tinstant_constructor_text(Vector &value, Vector &ts, Vec BinaryExecutor::Execute( value, ts, result, count, [&](string_t value, timestamp_tz_t ts) { - meosType temptype = TemporalHelpers::GetTemptypeFromAlias(result.GetType().GetAlias().c_str()); + MeosType temptype = TemporalHelpers::GetTemptypeFromAlias(result.GetType().GetAlias().c_str()); timestamp_tz_t meos_ts = DuckDBToMeosTimestamp(ts); std::string str = value.GetString(); @@ -243,7 +243,7 @@ void TemporalFunctions::Tsequence_constructor(DataChunk &args, ExpressionState & auto *list_entries = ListVector::GetData(array_vec); auto &child_vec = ListVector::GetEntry(array_vec); - meosType temptype = TemporalHelpers::GetTemptypeFromAlias(result.GetType().GetAlias().c_str()); + MeosType temptype = TemporalHelpers::GetTemptypeFromAlias(result.GetType().GetAlias().c_str()); interpType interp = temptype_supports_linear(temptype) ? LINEAR : STEP; bool lower_inc = true; bool upper_inc = true; @@ -410,7 +410,7 @@ void TemporalFunctions::Tsequenceset_constructor(DataChunk &args, ExpressionStat } } -static string_t Tsequence_from_base_tstzset_impl(Datum datum, string_t set_blob, meosType temptype, Vector &result) { +static string_t Tsequence_from_base_tstzset_impl(Datum datum, string_t set_blob, MeosType temptype, Vector &result) { size_t data_size = set_blob.GetSize(); if (data_size < sizeof(void*)) { throw InvalidInputException("[Tsequence_from_base_tstzset] Invalid tstzset data: insufficient size"); @@ -440,7 +440,7 @@ static string_t Tsequence_from_base_tstzset_impl(Datum datum, string_t set_blob, void TemporalFunctions::Tsequence_from_base_tstzset(DataChunk &args, ExpressionState &state, Vector &result) { auto count = args.size(); const auto &arg_type = args.data[0].GetType(); - meosType temptype = TemporalHelpers::GetTemptypeFromAlias(result.GetType().GetAlias().c_str()); + MeosType temptype = TemporalHelpers::GetTemptypeFromAlias(result.GetType().GetAlias().c_str()); if (arg_type.id() == LogicalTypeId::VARCHAR) { BinaryExecutor::Execute( @@ -485,7 +485,7 @@ void TemporalFunctions::Tsequence_from_base_tstzset(DataChunk &args, ExpressionS } } -static string_t Tsequence_from_base_tstzspan_impl(Datum datum, string_t span_blob, meosType temptype, interpType interp, Vector &result) { +static string_t Tsequence_from_base_tstzspan_impl(Datum datum, string_t span_blob, MeosType temptype, interpType interp, Vector &result) { size_t data_size = span_blob.GetSize(); if (data_size < sizeof(void*)) { throw InvalidInputException("[Tsequence_from_base_tstzspan] Invalid tstzspan data: insufficient size"); @@ -515,7 +515,7 @@ static string_t Tsequence_from_base_tstzspan_impl(Datum datum, string_t span_blo void TemporalFunctions::Tsequence_from_base_tstzspan(DataChunk &args, ExpressionState &state, Vector &result) { auto count = args.size(); const auto &arg_type = args.data[0].GetType(); - meosType temptype = TemporalHelpers::GetTemptypeFromAlias(result.GetType().GetAlias().c_str()); + MeosType temptype = TemporalHelpers::GetTemptypeFromAlias(result.GetType().GetAlias().c_str()); interpType interp = temptype_supports_linear(temptype) ? LINEAR : STEP; if (args.ColumnCount() > 2) { auto &interp_child = args.data[2]; @@ -568,7 +568,7 @@ void TemporalFunctions::Tsequence_from_base_tstzspan(DataChunk &args, Expression } } -static string_t Tsequenceset_from_base_tstzspanset_impl(Datum datum, string_t spanset_blob, meosType temptype, interpType interp, Vector &result) { +static string_t Tsequenceset_from_base_tstzspanset_impl(Datum datum, string_t spanset_blob, MeosType temptype, interpType interp, Vector &result) { size_t data_size = spanset_blob.GetSize(); if (data_size < sizeof(void*)) { throw InvalidInputException("[Tsequenceset_from_base_tstzspanset] Invalid tstzspanset data: insufficient size"); @@ -598,7 +598,7 @@ static string_t Tsequenceset_from_base_tstzspanset_impl(Datum datum, string_t sp void TemporalFunctions::Tsequenceset_from_base_tstzspanset(DataChunk &args, ExpressionState &state, Vector &result) { auto count = args.size(); const auto &arg_type = args.data[0].GetType(); - meosType temptype = TemporalHelpers::GetTemptypeFromAlias(result.GetType().GetAlias().c_str()); + MeosType temptype = TemporalHelpers::GetTemptypeFromAlias(result.GetType().GetAlias().c_str()); interpType interp = temptype_supports_linear(temptype) ? LINEAR : STEP; if (args.ColumnCount() > 2) { auto &interp_child = args.data[2]; @@ -861,7 +861,7 @@ bool TemporalFunctions::Tfloat_to_tint_cast(Vector &source, Vector &result, idx_ return true; } -static inline string_t Tnumber_to_tbox_common(Datum datum, meosType basetype, Vector &result) { +static inline string_t Tnumber_to_tbox_common(Datum datum, MeosType basetype, Vector &result) { TBox *tbox = number_tbox(datum, basetype); size_t tbox_size = sizeof(TBox); uint8_t *tbox_data = (uint8_t*)malloc(tbox_size); @@ -910,7 +910,7 @@ void TemporalFunctions::Tnumber_to_tbox(DataChunk &args, ExpressionState &state, return Tnumber_temporal_to_tbox_common(input, result); }); } else if (arg_type.id() == LogicalTypeId::DOUBLE || arg_type.id() == LogicalTypeId::FLOAT) { - meosType basetype = TemporalHelpers::GetTemptypeFromAlias(arg_type.GetAlias().c_str()); + MeosType basetype = TemporalHelpers::GetTemptypeFromAlias(arg_type.GetAlias().c_str()); UnaryExecutor::Execute( args.data[0], result, count, [&](double value) { @@ -918,7 +918,7 @@ void TemporalFunctions::Tnumber_to_tbox(DataChunk &args, ExpressionState &state, }); } else if (arg_type.id() == LogicalTypeId::INTEGER || arg_type.id() == LogicalTypeId::BIGINT || arg_type.id() == LogicalTypeId::SMALLINT || arg_type.id() == LogicalTypeId::TINYINT) { - meosType basetype = TemporalHelpers::GetTemptypeFromAlias(arg_type.GetAlias().c_str()); + MeosType basetype = TemporalHelpers::GetTemptypeFromAlias(arg_type.GetAlias().c_str()); UnaryExecutor::Execute( args.data[0], result, count, [&](int64_t value) { @@ -941,7 +941,7 @@ bool TemporalFunctions::Tnumber_to_tbox_cast(Vector &source, Vector &result, idx } ); } else if (source.GetType().id() == LogicalTypeId::DOUBLE) { - meosType basetype = TemporalHelpers::GetTemptypeFromAlias(source.GetType().GetAlias().c_str()); + MeosType basetype = TemporalHelpers::GetTemptypeFromAlias(source.GetType().GetAlias().c_str()); UnaryExecutor::Execute( source, result, count, [&](double value) { @@ -950,7 +950,7 @@ bool TemporalFunctions::Tnumber_to_tbox_cast(Vector &source, Vector &result, idx ); } else if (source.GetType().id() == LogicalTypeId::INTEGER || source.GetType().id() == LogicalTypeId::BIGINT || source.GetType().id() == LogicalTypeId::SMALLINT || source.GetType().id() == LogicalTypeId::TINYINT) { - meosType basetype = TemporalHelpers::GetTemptypeFromAlias(source.GetType().GetAlias().c_str()); + MeosType basetype = TemporalHelpers::GetTemptypeFromAlias(source.GetType().GetAlias().c_str()); UnaryExecutor::Execute( source, result, count, [&](int64_t value) { @@ -1121,7 +1121,7 @@ void TemporalFunctions::Temporal_valueset(DataChunk &args, ExpressionState &stat } int32_t count; Datum *values = temporal_values_p(temp, &count); - meosType basetype = temptype_basetype((meosType)temp->temptype); + MeosType basetype = temptype_basetype((MeosType)temp->temptype); if (temp->temptype == T_TBOOL) { // TODO: handle tbool } @@ -2416,7 +2416,7 @@ void TemporalFunctions::Temporal_set_interp(DataChunk &args, ExpressionState &st void TemporalFunctions::Temporal_append_tinstant(DataChunk &args, ExpressionState &state, Vector &result) { auto count = args.size(); - meosType temptype = TemporalHelpers::GetTemptypeFromAlias(result.GetType().GetAlias().c_str()); + MeosType temptype = TemporalHelpers::GetTemptypeFromAlias(result.GetType().GetAlias().c_str()); interpType interp = temptype_supports_linear(temptype) ? LINEAR : STEP; if (args.ColumnCount() > 2) { auto &interp_child = args.data[2]; @@ -5806,7 +5806,7 @@ DEFINE_TCMP_NUMERIC(Tge, tge) ****************************************************/ template -void TemporalFunctions::Temporal_dump_common(DataChunk &args, Vector &result, meosType basetype) { +void TemporalFunctions::Temporal_dump_common(DataChunk &args, Vector &result, MeosType basetype) { auto count = args.size(); auto &temp_vec = args.data[0]; UnifiedVectorFormat temp_format; From 9e1d7a68b6f41eb56b0db3c566621ceb9c6a52d6 Mon Sep 17 00:00:00 2001 From: Esteban Zimanyi Date: Fri, 15 May 2026 08:49:29 +0200 Subject: [PATCH 08/13] Pre-stage icu extension for amd64 docker tests LoadInternal calls ExtensionHelper::AutoLoadExtension(db, "icu") so the Europe/Brussels timezone option is honoured. Inside the linux_amd64 test docker container there is no network egress and the local extension directory is empty, so the autoload fails. Copy the icu.duckdb_extension that was just built locally (declared in extension_config.cmake) into the expected path before running the unittester. --- Makefile | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index bc17d050..ab8cf2ee 100644 --- a/Makefile +++ b/Makefile @@ -11,9 +11,32 @@ include extension-ci-tools/makefiles/duckdb_extension.Makefile # both MEOS (meos_initialize_timezone) and DuckDB (DBConfig::SetOptionByName # "TimeZone") to Europe/Brussels. Tests pass on any OS timezone — the # extension is the single source of truth, no TZ env var needed. +# +# LoadInternal also calls ExtensionHelper::AutoLoadExtension(db, "icu") so +# the timezone option is honoured. Autoload looks for the extension on disk +# at $HOME/.duckdb/extensions///icu.duckdb_extension +# and falls back to a hub download. Inside the linux_amd64 test docker +# container that path is empty and there is no network egress, so the +# autoload fails. We copy the icu.duckdb_extension that was built locally +# as part of this extension's build (declared in extension_config.cmake) +# into the expected path before running the unittester. +DUCKDB_VERSION_TAG := v1.4.4 + +define stage_icu + @if [ -f ./build/$(1)/extension/icu/icu.duckdb_extension ]; then \ + platform=$$(uname -m | sed 's/x86_64/linux_amd64/;s/aarch64/linux_arm64/'); \ + target=$$HOME/.duckdb/extensions/$(DUCKDB_VERSION_TAG)/$$platform; \ + mkdir -p "$$target" && cp -f ./build/$(1)/extension/icu/icu.duckdb_extension "$$target/" && \ + echo "Staged icu.duckdb_extension at $$target/"; \ + fi +endef + test_release_internal: + $(call stage_icu,release) ./build/release/$(TEST_PATH) "$(PROJ_DIR)test/*" test_debug_internal: + $(call stage_icu,debug) ./build/debug/$(TEST_PATH) "$(PROJ_DIR)test/*" test_reldebug_internal: - ./build/reldebug/$(TEST_PATH) "$(PROJ_DIR)test/*" \ No newline at end of file + $(call stage_icu,reldebug) + ./build/reldebug/$(TEST_PATH) "$(PROJ_DIR)test/*" From f896b95701176dfc1b208ff0e2e43e1ecdd1abd7 Mon Sep 17 00:00:00 2001 From: Esteban Zimanyi Date: Sat, 16 May 2026 08:14:16 +0200 Subject: [PATCH 09/13] Initialize MEOS per worker thread MEOS keeps the session timezone, errno, PROJ context and RNGs in thread-local storage and requires every thread that calls into it to run meos_initialize() before its first call. The extension only did this once on the load thread, so DuckDB TaskScheduler workers ran scalar, cast and aggregate bodies with a NULL session_timezone and segfaulted in pg_next_dst_boundary on the first timestamp parse. A thread-local guard now runs the per-thread init (and re-installs the process-global error handler, which meos_initialize() resets to the exit-on-error default) at the scalar exec wrapper and through a cast registration trampoline covering every cast entry point. --- src/geo/geoset.cpp | 4 +-- src/geo/stbox.cpp | 14 ++++---- src/geo/tgeogpoint.cpp | 8 ++--- src/geo/tgeogpoint_in_out.cpp | 5 +-- src/geo/tgeography_in_out.cpp | 4 +-- src/geo/tgeometry_in_out.cpp | 4 +-- src/geo/tgeompoint.cpp | 8 ++--- src/include/mobilityduck/meos_exec_serial.hpp | 32 +++++++++++++++++ src/include/mobilityduck/meos_thread.hpp | 34 +++++++++++++++++++ src/temporal/set.cpp | 14 ++++---- src/temporal/span.cpp | 30 ++++++++-------- src/temporal/spanset.cpp | 20 +++++------ src/temporal/tbox.cpp | 34 +++++++++---------- src/temporal/temporal.cpp | 16 ++++----- 14 files changed, 147 insertions(+), 80 deletions(-) create mode 100644 src/include/mobilityduck/meos_thread.hpp diff --git a/src/geo/geoset.cpp b/src/geo/geoset.cpp index 842045dd..1e19887e 100644 --- a/src/geo/geoset.cpp +++ b/src/geo/geoset.cpp @@ -36,12 +36,12 @@ void SpatialSetType::RegisterTypes(ExtensionLoader &loader){ } void SpatialSetType::RegisterCastFunctions(ExtensionLoader &loader) { - loader.RegisterCastFunction( + RegisterMeosCastFunction(loader, LogicalType::VARCHAR, SpatialSetType::geomset(), SpatialSetFunctions::Text_to_geoset ); - loader.RegisterCastFunction( + RegisterMeosCastFunction(loader, LogicalType::VARCHAR, SpatialSetType::geogset(), SpatialSetFunctions::Text_to_geoset diff --git a/src/geo/stbox.cpp b/src/geo/stbox.cpp index 8038f09b..7de72be5 100644 --- a/src/geo/stbox.cpp +++ b/src/geo/stbox.cpp @@ -27,43 +27,43 @@ void StboxType::RegisterType(ExtensionLoader &loader) { } void StboxType::RegisterCastFunctions(ExtensionLoader &loader) { - loader.RegisterCastFunction( + RegisterMeosCastFunction(loader, LogicalType::VARCHAR, STBOX(), StboxFunctions::Stbox_in_cast ); - loader.RegisterCastFunction( + RegisterMeosCastFunction(loader, STBOX(), LogicalType::VARCHAR, StboxFunctions::Stbox_out ); - loader.RegisterCastFunction( + RegisterMeosCastFunction(loader, GeoTypes::GEOMETRY(), STBOX(), StboxFunctions::Geo_to_stbox_cast ); - loader.RegisterCastFunction( + RegisterMeosCastFunction(loader, LogicalType::TIMESTAMP_TZ, STBOX(), StboxFunctions::Timestamptz_to_stbox_cast ); - loader.RegisterCastFunction( + RegisterMeosCastFunction(loader, SetTypes::tstzset(), STBOX(), StboxFunctions::Tstzset_to_stbox_cast ); - loader.RegisterCastFunction( + RegisterMeosCastFunction(loader, SpanTypes::TSTZSPAN(), STBOX(), StboxFunctions::Tstzspan_to_stbox_cast ); - loader.RegisterCastFunction( + RegisterMeosCastFunction(loader, SpansetTypes::tstzspanset(), STBOX(), StboxFunctions::Tstzspanset_to_stbox_cast diff --git a/src/geo/tgeogpoint.cpp b/src/geo/tgeogpoint.cpp index 42e068e1..e811afde 100644 --- a/src/geo/tgeogpoint.cpp +++ b/src/geo/tgeogpoint.cpp @@ -43,25 +43,25 @@ void TgeogpointType::RegisterType(ExtensionLoader &loader) { } void TgeogpointType::RegisterCastFunctions(ExtensionLoader &loader) { - loader.RegisterCastFunction( + RegisterMeosCastFunction(loader, LogicalType::VARCHAR, TGEOGPOINT(), TgeogpointFunctions::Tpoint_in ); - loader.RegisterCastFunction( + RegisterMeosCastFunction(loader, TGEOGPOINT(), LogicalType::VARCHAR, TemporalFunctions::Temporal_out ); - loader.RegisterCastFunction( + RegisterMeosCastFunction(loader, TGEOGPOINT(), StboxType::STBOX(), TgeompointFunctions::Tspatial_to_stbox_cast ); - loader.RegisterCastFunction( + RegisterMeosCastFunction(loader, TGEOGPOINT(), SpanTypes::TSTZSPAN(), TgeompointFunctions::Temporal_to_tstzspan_cast diff --git a/src/geo/tgeogpoint_in_out.cpp b/src/geo/tgeogpoint_in_out.cpp index 63645c33..f0efb6c5 100644 --- a/src/geo/tgeogpoint_in_out.cpp +++ b/src/geo/tgeogpoint_in_out.cpp @@ -2,6 +2,7 @@ #include "geo/tgeogpoint_functions.hpp" #include "duckdb/main/extension/extension_loader.hpp" #include "duckdb/common/extension_type_info.hpp" +#include "mobilityduck/meos_exec_serial.hpp" #include #include #include @@ -215,8 +216,8 @@ void TGeogpointType::RegisterScalarInOutFunctions(ExtensionLoader &loader){ void TGeogpointType::RegisterCastFunctions(ExtensionLoader &loader) { - loader.RegisterCastFunction( LogicalType::VARCHAR, TGeogpointType::TGEOGPOINT(), TgeogpointFunctions::StringToTgeogpoint); - loader.RegisterCastFunction( TGeogpointType::TGEOGPOINT(), LogicalType::VARCHAR, TgeogpointFunctions::TgeogpointToString); + RegisterMeosCastFunction(loader, LogicalType::VARCHAR, TGeogpointType::TGEOGPOINT(), TgeogpointFunctions::StringToTgeogpoint); + RegisterMeosCastFunction(loader, TGeogpointType::TGEOGPOINT(), LogicalType::VARCHAR, TgeogpointFunctions::TgeogpointToString); } } diff --git a/src/geo/tgeography_in_out.cpp b/src/geo/tgeography_in_out.cpp index 3d5fac17..4aedbd31 100644 --- a/src/geo/tgeography_in_out.cpp +++ b/src/geo/tgeography_in_out.cpp @@ -288,8 +288,8 @@ void TGeographyTypes::RegisterScalarInOutFunctions(ExtensionLoader &loader){ void TGeographyTypes::RegisterCastFunctions(ExtensionLoader &loader) { - loader.RegisterCastFunction( LogicalType::VARCHAR, TGeographyTypes::TGEOGRAPHY(), TgeographyFunctions::StringToTgeography); - loader.RegisterCastFunction( TGeographyTypes::TGEOGRAPHY(), LogicalType::VARCHAR, TgeographyFunctions::TgeographyToString); + RegisterMeosCastFunction(loader, LogicalType::VARCHAR, TGeographyTypes::TGEOGRAPHY(), TgeographyFunctions::StringToTgeography); + RegisterMeosCastFunction(loader, TGeographyTypes::TGEOGRAPHY(), LogicalType::VARCHAR, TgeographyFunctions::TgeographyToString); } } diff --git a/src/geo/tgeometry_in_out.cpp b/src/geo/tgeometry_in_out.cpp index 7c8d5a87..5b88aec2 100644 --- a/src/geo/tgeometry_in_out.cpp +++ b/src/geo/tgeometry_in_out.cpp @@ -292,8 +292,8 @@ void TGeometryTypes::RegisterScalarInOutFunctions(ExtensionLoader &loader){ void TGeometryTypes::RegisterCastFunctions(ExtensionLoader &loader) { - loader.RegisterCastFunction( LogicalType::VARCHAR, TGeometryTypes::TGEOMETRY(), TgeometryFunctions::StringToTgeometry); - loader.RegisterCastFunction( TGeometryTypes::TGEOMETRY(), LogicalType::VARCHAR, TgeometryFunctions::TgeometryToString); + RegisterMeosCastFunction(loader, LogicalType::VARCHAR, TGeometryTypes::TGEOMETRY(), TgeometryFunctions::StringToTgeometry); + RegisterMeosCastFunction(loader, TGeometryTypes::TGEOMETRY(), LogicalType::VARCHAR, TgeometryFunctions::TgeometryToString); } } diff --git a/src/geo/tgeompoint.cpp b/src/geo/tgeompoint.cpp index 4f99e60f..9bfdf2aa 100644 --- a/src/geo/tgeompoint.cpp +++ b/src/geo/tgeompoint.cpp @@ -34,25 +34,25 @@ void TgeompointType::RegisterType(ExtensionLoader &loader) { } void TgeompointType::RegisterCastFunctions(ExtensionLoader &loader) { - loader.RegisterCastFunction( + RegisterMeosCastFunction(loader, LogicalType::VARCHAR, TGEOMPOINT(), TgeompointFunctions::Tpoint_in ); - loader.RegisterCastFunction( + RegisterMeosCastFunction(loader, TGEOMPOINT(), LogicalType::VARCHAR, TemporalFunctions::Temporal_out ); - loader.RegisterCastFunction( + RegisterMeosCastFunction(loader, TGEOMPOINT(), StboxType::STBOX(), TgeompointFunctions::Tspatial_to_stbox_cast ); - loader.RegisterCastFunction( + RegisterMeosCastFunction(loader, TGEOMPOINT(), SpanTypes::TSTZSPAN(), TgeompointFunctions::Temporal_to_tstzspan_cast diff --git a/src/include/mobilityduck/meos_exec_serial.hpp b/src/include/mobilityduck/meos_exec_serial.hpp index 5e3ba782..e12d9c5c 100644 --- a/src/include/mobilityduck/meos_exec_serial.hpp +++ b/src/include/mobilityduck/meos_exec_serial.hpp @@ -2,8 +2,10 @@ #include +#include "duckdb/function/cast/default_casts.hpp" #include "duckdb/function/scalar_function.hpp" #include "duckdb/main/extension/extension_loader.hpp" +#include "mobilityduck/meos_thread.hpp" namespace duckdb { @@ -26,6 +28,7 @@ inline ScalarFunction WrapScalarFunctionWithMeosExecMutex(ScalarFunction sf) { scalar_function_t orig = std::move(sf.function); sf.function = [orig = std::move(orig)](DataChunk &args, ExpressionState &state, Vector &result) { std::lock_guard guard(MeosSerializedExecMutex()); + EnsureMeosThreadInitialized(); orig(args, state, result); }; return sf; @@ -35,4 +38,33 @@ inline void RegisterSerializedScalarFunction(ExtensionLoader &loader, ScalarFunc loader.RegisterFunction(WrapScalarFunctionWithMeosExecMutex(std::move(sf))); } +/** + * Cast functions are a separate registration path from scalar functions and + * have no shared execution wrapper, yet they call MEOS just the same (e.g. the + * VARCHAR -> tgeompoint parse). The original function pointer is stashed in + * the bound cast data and reached through a trampoline that runs the + * per-thread MEOS init before delegating. MobilityDuck cast functions do not + * use cast_data themselves, so forwarding it untouched is safe. + */ +struct MeosCastData : BoundCastData { + explicit MeosCastData(cast_function_t orig_p) : orig(orig_p) { + } + cast_function_t orig; + unique_ptr Copy() const override { + return make_uniq(orig); + } +}; + +inline bool MeosCastTrampoline(Vector &source, Vector &result, idx_t count, CastParameters ¶meters) { + EnsureMeosThreadInitialized(); + auto &data = parameters.cast_data->Cast(); + return data.orig(source, result, count, parameters); +} + +inline void RegisterMeosCastFunction(ExtensionLoader &loader, const LogicalType &source, const LogicalType &target, + cast_function_t function, int64_t implicit_cast_cost = -1) { + loader.RegisterCastFunction(source, target, BoundCastInfo(MeosCastTrampoline, make_uniq(function)), + implicit_cast_cost); +} + } // namespace duckdb diff --git a/src/include/mobilityduck/meos_thread.hpp b/src/include/mobilityduck/meos_thread.hpp new file mode 100644 index 00000000..e23eef3d --- /dev/null +++ b/src/include/mobilityduck/meos_thread.hpp @@ -0,0 +1,34 @@ +#pragma once + +extern "C" { +#include +} + +// Defined in mobilityduck_extension.cpp. Converts MEOS errors into DuckDB +// exceptions instead of the process-exiting default handler. +extern "C" void MobilityduckMeosErrorHandler(int errlevel, int errcode, const char *errmsg); + +namespace duckdb { + +// MEOS keeps the session timezone, errno, PROJ context and the RNGs in +// thread-local storage; each thread that calls MEOS must initialise it +// before its first call (see meos.h, "Multithreading"). DuckDB runs +// scalar, cast and aggregate bodies on TaskScheduler worker threads, so a +// one-shot init on the load thread leaves workers with a NULL +// session_timezone and pg_next_dst_boundary segfaults on the first +// timestamp parse. This runs the per-thread init exactly once per thread. +// +// meos_initialize() resets the process-global error handler to the +// exit-on-error default, so MobilityduckMeosErrorHandler is re-installed +// here; the store is an idempotent atomic write of the same pointer. +inline void EnsureMeosThreadInitialized() { + static thread_local const bool meos_thread_ready = []() { + meos_initialize(); + meos_initialize_error_handler(&MobilityduckMeosErrorHandler); + meos_initialize_timezone("Europe/Brussels"); + return true; + }(); + (void) meos_thread_ready; +} + +} // namespace duckdb diff --git a/src/temporal/set.cpp b/src/temporal/set.cpp index bf185b90..f1c26bd3 100644 --- a/src/temporal/set.cpp +++ b/src/temporal/set.cpp @@ -93,43 +93,43 @@ LogicalType SetTypeMapping::GetChildType(const LogicalType &type) { // Register all cast functions void SetTypes::RegisterCastFunctions(ExtensionLoader &loader) { for (const auto &set_type : SetTypes::AllTypes()) { - loader.RegisterCastFunction( + RegisterMeosCastFunction(loader, set_type, LogicalType::VARCHAR, SetFunctions::Set_to_text ); // Blob to text - loader.RegisterCastFunction( + RegisterMeosCastFunction(loader, LogicalType::VARCHAR, set_type, SetFunctions::Text_to_set ); // text to blob auto base_type = SetTypeMapping::GetChildType(set_type); - loader.RegisterCastFunction( + RegisterMeosCastFunction(loader, base_type, set_type, SetFunctions::Value_to_set_cast // set from base type ); - loader.RegisterCastFunction( + RegisterMeosCastFunction(loader, SetTypes::intset(), SetTypes::floatset(), SetFunctions::Intset_to_floatset_cast // intset -> floatset ); - loader.RegisterCastFunction( + RegisterMeosCastFunction(loader, SetTypes::floatset(), SetTypes::intset(), SetFunctions::Floatset_to_intset_cast // floatset --> intset ); - loader.RegisterCastFunction( + RegisterMeosCastFunction(loader, SetTypes::dateset(), SetTypes::tstzset(), SetFunctions::Dateset_to_tstzset_cast // dateset -> tstzset ); - loader.RegisterCastFunction( + RegisterMeosCastFunction(loader, SetTypes::tstzset(), SetTypes::dateset(), SetFunctions::Tstzset_to_dateset_cast // tstz -> dateset diff --git a/src/temporal/span.cpp b/src/temporal/span.cpp index b874625d..48dce1ff 100644 --- a/src/temporal/span.cpp +++ b/src/temporal/span.cpp @@ -89,68 +89,68 @@ LogicalType SpanTypeMapping::GetChildType(const LogicalType &type) { // Register all cast functions void SpanTypes::RegisterCastFunctions(ExtensionLoader &loader) { for (const auto &span_type : SpanTypes::AllTypes()) { - loader.RegisterCastFunction( + RegisterMeosCastFunction(loader, span_type, LogicalType::VARCHAR, SpanFunctions::Span_to_text ); // Blob to text - loader.RegisterCastFunction( + RegisterMeosCastFunction(loader, LogicalType::VARCHAR, span_type, SpanFunctions::Text_to_span ); // text to blob - loader.RegisterCastFunction( + RegisterMeosCastFunction(loader, SpanTypes::INTSPAN(), SpanTypes::FLOATSPAN(), SpanFunctions::Intspan_to_floatspan_cast // intspan -> floatspan ); - loader.RegisterCastFunction( + RegisterMeosCastFunction(loader, SpanTypes::FLOATSPAN(), SpanTypes::INTSPAN(), SpanFunctions::Floatspan_to_intspan_cast // floatspan -> intspan ); - loader.RegisterCastFunction( + RegisterMeosCastFunction(loader, SpanTypes::DATESPAN(), SpanTypes::TSTZSPAN(), SpanFunctions::Datespan_to_tstzspan_cast // datespan -> tstzspan ); - loader.RegisterCastFunction( + RegisterMeosCastFunction(loader, SpanTypes::TSTZSPAN(), SpanTypes::DATESPAN(), SpanFunctions::Tstzspan_to_datespan_cast // tstzspan -> datespan ); - loader.RegisterCastFunction( + RegisterMeosCastFunction(loader, SetTypes::intset(), SpanTypes::INTSPAN(), SpanFunctions::Set_to_span_cast // intset -> intspan ); - loader.RegisterCastFunction( + RegisterMeosCastFunction(loader, SetTypes::bigintset(), SpanTypes::BIGINTSPAN(), SpanFunctions::Set_to_span_cast // bigintset -> bigintspan ); - loader.RegisterCastFunction( + RegisterMeosCastFunction(loader, SetTypes::floatset(), SpanTypes::FLOATSPAN(), SpanFunctions::Set_to_span_cast // floatset -> floatspan ); - loader.RegisterCastFunction( + RegisterMeosCastFunction(loader, SetTypes::tstzset(), SpanTypes::TSTZSPAN(), SpanFunctions::Set_to_span_cast // tstzset -> tstzspan ); // Scalar value -> span casts - loader.RegisterCastFunction(LogicalType::INTEGER, SpanTypes::INTSPAN(), SpanFunctions::Value_to_span_cast); - loader.RegisterCastFunction(LogicalType::BIGINT, SpanTypes::BIGINTSPAN(), SpanFunctions::Value_to_span_cast); - loader.RegisterCastFunction(LogicalType::DOUBLE, SpanTypes::FLOATSPAN(), SpanFunctions::Value_to_span_cast); - loader.RegisterCastFunction(LogicalType::DATE, SpanTypes::DATESPAN(), SpanFunctions::Value_to_span_cast); - loader.RegisterCastFunction(LogicalType::TIMESTAMP_TZ, SpanTypes::TSTZSPAN(), SpanFunctions::Value_to_span_cast); + RegisterMeosCastFunction(loader, LogicalType::INTEGER, SpanTypes::INTSPAN(), SpanFunctions::Value_to_span_cast); + RegisterMeosCastFunction(loader, LogicalType::BIGINT, SpanTypes::BIGINTSPAN(), SpanFunctions::Value_to_span_cast); + RegisterMeosCastFunction(loader, LogicalType::DOUBLE, SpanTypes::FLOATSPAN(), SpanFunctions::Value_to_span_cast); + RegisterMeosCastFunction(loader, LogicalType::DATE, SpanTypes::DATESPAN(), SpanFunctions::Value_to_span_cast); + RegisterMeosCastFunction(loader, LogicalType::TIMESTAMP_TZ, SpanTypes::TSTZSPAN(), SpanFunctions::Value_to_span_cast); } } diff --git a/src/temporal/spanset.cpp b/src/temporal/spanset.cpp index 5c38c8e4..2c2c0e66 100644 --- a/src/temporal/spanset.cpp +++ b/src/temporal/spanset.cpp @@ -103,62 +103,62 @@ LogicalType SpansetTypeMapping::GetBaseType(const LogicalType &type) { // --- Register Cast --- void SpansetTypes::RegisterCastFunctions(ExtensionLoader &loader) { for (const auto &spanset_type : SpansetTypes::AllTypes()) { - loader.RegisterCastFunction( + RegisterMeosCastFunction(loader, spanset_type, LogicalType::VARCHAR, SpansetFunctions::Spanset_to_text ); // Blob to text - loader.RegisterCastFunction( + RegisterMeosCastFunction(loader, LogicalType::VARCHAR, spanset_type, SpansetFunctions::Text_to_spanset ); // text to blob auto base_type = SpansetTypeMapping::GetBaseType(spanset_type); - loader.RegisterCastFunction( + RegisterMeosCastFunction(loader, base_type, spanset_type, SpansetFunctions::Value_to_spanset_cast ); auto set_type = SpansetTypeMapping::GetSetType(spanset_type); - loader.RegisterCastFunction( + RegisterMeosCastFunction(loader, set_type, spanset_type, SpansetFunctions::Set_to_spanset_cast ); auto child_type = SpansetTypeMapping::GetChildType(spanset_type); // span - loader.RegisterCastFunction( + RegisterMeosCastFunction(loader, child_type, spanset_type, SpansetFunctions::Span_to_spanset_cast ); - loader.RegisterCastFunction( + RegisterMeosCastFunction(loader, spanset_type, child_type, SpansetFunctions::Spanset_to_span_cast ); - loader.RegisterCastFunction( + RegisterMeosCastFunction(loader, SpansetTypes::intspanset(), SpansetTypes::floatspanset(), SpansetFunctions::Intspanset_to_floatspanset_cast ); - loader.RegisterCastFunction( + RegisterMeosCastFunction(loader, SpansetTypes::floatspanset(), SpansetTypes::intspanset(), SpansetFunctions::Floatspanset_to_intspanset_cast ); - loader.RegisterCastFunction( + RegisterMeosCastFunction(loader, SpansetTypes::datespanset(), SpansetTypes::tstzspanset(), SpansetFunctions::Datespanset_to_tstzspanset_cast ); - loader.RegisterCastFunction( + RegisterMeosCastFunction(loader, SpansetTypes::tstzspanset(), SpansetTypes::datespanset(), SpansetFunctions::Tstzspanset_to_datespanset_cast diff --git a/src/temporal/tbox.cpp b/src/temporal/tbox.cpp index 4e342038..f093cc33 100644 --- a/src/temporal/tbox.cpp +++ b/src/temporal/tbox.cpp @@ -27,103 +27,103 @@ void TboxType::RegisterType(ExtensionLoader &loader) { } void TboxType::RegisterCastFunctions(ExtensionLoader &loader) { - loader.RegisterCastFunction( + RegisterMeosCastFunction(loader, LogicalType::VARCHAR, TBOX(), TboxFunctions::Tbox_in ); - loader.RegisterCastFunction( + RegisterMeosCastFunction(loader, TBOX(), LogicalType::VARCHAR, TboxFunctions::Tbox_out ); - loader.RegisterCastFunction( + RegisterMeosCastFunction(loader, LogicalType::INTEGER, TBOX(), TboxFunctions::Number_to_tbox_cast ); - loader.RegisterCastFunction( + RegisterMeosCastFunction(loader, LogicalType::DOUBLE, TBOX(), TboxFunctions::Number_to_tbox_cast ); - loader.RegisterCastFunction( + RegisterMeosCastFunction(loader, LogicalType::TIMESTAMP_TZ, TBOX(), TboxFunctions::Timestamptz_to_tbox_cast ); - loader.RegisterCastFunction( + RegisterMeosCastFunction(loader, SetTypes::intset(), TBOX(), TboxFunctions::Set_to_tbox_cast ); - loader.RegisterCastFunction( + RegisterMeosCastFunction(loader, SetTypes::floatset(), TBOX(), TboxFunctions::Set_to_tbox_cast ); - loader.RegisterCastFunction( + RegisterMeosCastFunction(loader, SetTypes::tstzset(), TBOX(), TboxFunctions::Set_to_tbox_cast ); - loader.RegisterCastFunction( + RegisterMeosCastFunction(loader, SpanTypes::INTSPAN(), TBOX(), TboxFunctions::Span_to_tbox_cast ); - loader.RegisterCastFunction( + RegisterMeosCastFunction(loader, SpanTypes::FLOATSPAN(), TBOX(), TboxFunctions::Span_to_tbox_cast ); - loader.RegisterCastFunction( + RegisterMeosCastFunction(loader, SpanTypes::TSTZSPAN(), TBOX(), TboxFunctions::Span_to_tbox_cast ); - loader.RegisterCastFunction( + RegisterMeosCastFunction(loader, TBOX(), SpanTypes::INTSPAN(), TboxFunctions::Tbox_to_intspan_cast ); - loader.RegisterCastFunction( + RegisterMeosCastFunction(loader, TBOX(), SpanTypes::FLOATSPAN(), TboxFunctions::Tbox_to_floatspan_cast ); - loader.RegisterCastFunction( + RegisterMeosCastFunction(loader, TBOX(), SpanTypes::TSTZSPAN(), TboxFunctions::Tbox_to_tstzspan_cast ); - loader.RegisterCastFunction( + RegisterMeosCastFunction(loader, SpansetTypes::intspanset(), TBOX(), TboxFunctions::Spanset_to_tbox_cast ); - loader.RegisterCastFunction( + RegisterMeosCastFunction(loader, SpansetTypes::floatspanset(), TBOX(), TboxFunctions::Spanset_to_tbox_cast ); - loader.RegisterCastFunction( + RegisterMeosCastFunction(loader, SpansetTypes::tstzspanset(), TBOX(), TboxFunctions::Spanset_to_tbox_cast diff --git a/src/temporal/temporal.cpp b/src/temporal/temporal.cpp index 7a64b498..87e36a9d 100644 --- a/src/temporal/temporal.cpp +++ b/src/temporal/temporal.cpp @@ -69,13 +69,13 @@ LogicalType TemporalTypes::GetBaseTypeFromAlias(const char *alias) { void TemporalTypes::RegisterCastFunctions(ExtensionLoader &loader) { for (auto &type : TemporalTypes::AllTypes()) { - loader.RegisterCastFunction( + RegisterMeosCastFunction(loader, LogicalType::VARCHAR, type, TemporalFunctions::Temporal_in ); - loader.RegisterCastFunction( + RegisterMeosCastFunction(loader, type, LogicalType::VARCHAR, TemporalFunctions::Temporal_out @@ -90,37 +90,37 @@ void TemporalTypes::RegisterCastFunctions(ExtensionLoader &loader) { // ); // } - loader.RegisterCastFunction( + RegisterMeosCastFunction(loader, LogicalType::BLOB, SpansetTypes::tstzspanset(), TemporalFunctions::Blob_to_tstzspanset ); - loader.RegisterCastFunction( + RegisterMeosCastFunction(loader, TemporalTypes::TBOOL(), TemporalTypes::TINT(), TemporalFunctions::Tbool_to_tint_cast ); - loader.RegisterCastFunction( + RegisterMeosCastFunction(loader, TemporalTypes::TINT(), TemporalTypes::TFLOAT(), TemporalFunctions::Tint_to_tfloat_cast ); - loader.RegisterCastFunction( + RegisterMeosCastFunction(loader, TemporalTypes::TFLOAT(), TemporalTypes::TINT(), TemporalFunctions::Tfloat_to_tint_cast ); - loader.RegisterCastFunction( + RegisterMeosCastFunction(loader, TemporalTypes::TINT(), TboxType::TBOX(), TemporalFunctions::Tnumber_to_tbox_cast ); - loader.RegisterCastFunction( + RegisterMeosCastFunction(loader, TemporalTypes::TFLOAT(), TboxType::TBOX(), TemporalFunctions::Tnumber_to_tbox_cast From c3dfb70b8e6ed72300c5f05f189d69cf0e533ce9 Mon Sep 17 00:00:00 2001 From: Esteban Zimanyi Date: Sat, 16 May 2026 08:47:43 +0200 Subject: [PATCH 10/13] Refresh tnumber ln/exp/log expected output for MEOS turning points The MEOS uplift adds tfloat_ln_turnpt / tfloat_exp_turnpt, which insert one chord-error-minimising turning point on a linear input segment for the transcendental unary lifts. ln/log10/exp over a two-instant input now return three instants. Update the 026b expectations to the new values; the deltaValue, trend and arithmetic-alias cases are linear and unchanged. --- test/sql/parity/026b_tnumber_mathfuncs_followups.test | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/test/sql/parity/026b_tnumber_mathfuncs_followups.test b/test/sql/parity/026b_tnumber_mathfuncs_followups.test index 64027f7a..4f0a0b50 100644 --- a/test/sql/parity/026b_tnumber_mathfuncs_followups.test +++ b/test/sql/parity/026b_tnumber_mathfuncs_followups.test @@ -6,22 +6,25 @@ require mobilityduck -# Unary tfloat math: ln(e) ≈ 1, log10(100) = 2, exp(0) = 1 +# Unary tfloat math: ln(e) ≈ 1, log10(100) = 2, exp(0) = 1. +# These lifts insert one chord-error-minimising turning point on the linear +# input segment (tfloat_ln_turnpt / tfloat_exp_turnpt), so the result has +# three instants where the input had two. query I SELECT round(ln(tfloat '[1@2000-01-01, 2.71828182845905@2000-01-02]'), 6); ---- -[0@2000-01-01 00:00:00+01, 1@2000-01-02 00:00:00+01] +[0@2000-01-01 00:00:00+01, 0.541325@2000-01-01 10:01:57.212526+01, 1@2000-01-02 00:00:00+01] query I SELECT log10(tfloat '[1@2000-01-01, 100@2000-01-02]'); ---- -[0@2000-01-01 00:00:00+01, 2@2000-01-02 00:00:00+01] +[0@2000-01-01 00:00:00+01, 1.332389510222689@2000-01-01 04:58:08.794345+01, 2@2000-01-02 00:00:00+01] query I SELECT round(exp(tfloat '[0@2000-01-01, 1@2000-01-02]'), 6); ---- -[1@2000-01-01 00:00:00+01, 2.718282@2000-01-02 00:00:00+01] +[1@2000-01-01 00:00:00+01, 1.718282@2000-01-01 12:59:30.467438+01, 2.718282@2000-01-02 00:00:00+01] # deltaValue — successive differences From a8b1755dfeb0918ad8a3fb6d330f001f19e1b873 Mon Sep 17 00:00:00 2001 From: Esteban Zimanyi Date: Sat, 16 May 2026 09:47:58 +0200 Subject: [PATCH 11/13] Wrap bigint_to_set in an int64_t forwarder for SetUnionAgg On macOS LP64 int64 (long) and int64_t (long long) are the same width but distinct types, so clang rejects bigint_to_set as the non-type template argument of SetUnionScalarFunction, failing the osx_amd64 and osx_arm64 builds at src/temporal/set.cpp. Add a bigint_to_set_duckdb forwarder that takes int64_t and casts to int64 before calling MEOS, mirroring the existing date_to_set_duckdb idiom. The cast is a no-op on Linux. Co-Authored-By: Claude Opus 4.7 --- src/temporal/set.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/temporal/set.cpp b/src/temporal/set.cpp index f1c26bd3..d63aee7c 100644 --- a/src/temporal/set.cpp +++ b/src/temporal/set.cpp @@ -945,6 +945,14 @@ static inline Set *date_to_set_duckdb(DateADT d) { return date_to_set(ToMeosDate(duckdb::date_t(d))); } +// macOS LP64: int64 (long) and int64_t (long long) are the same width but +// distinct types, so clang rejects passing bigint_to_set where a +// Set *(*)(int64_t) is expected as a non-type template arg. The cast is a +// no-op on Linux. See SetUnionScalarFunction below. +static inline Set *bigint_to_set_duckdb(int64_t i) { + return bigint_to_set(static_cast(i)); +} + struct SetPtrState { Set *accumulated; }; @@ -1069,7 +1077,7 @@ void SetTypes::RegisterSetUnionAgg(ExtensionLoader &loader) { LogicalType::INTEGER, SetTypes::intset())); set_union_set.AddFunction( AggregateFunction::UnaryAggregateDestructor>( + SetUnionScalarFunction>( LogicalType::BIGINT, SetTypes::bigintset())); set_union_set.AddFunction( AggregateFunction::UnaryAggregateDestructor Date: Sat, 16 May 2026 11:04:41 +0200 Subject: [PATCH 12/13] Stage icu for the macOS osx_arm64 test path too The stage_icu helper mapped only the Linux uname values, so on the macOS arm64 test runner uname -m returned "arm64" and the icu extension was copied to .duckdb/extensions/v1.4.4/arm64 instead of .../osx_arm64, where DuckDB's autoload looks. The hub fallback is not reliably resolvable on that runner, so the osx_arm64 Test step failed to load the extension. Map the OS and architecture to the DuckDB platform string (linux_amd64, linux_arm64, osx_amd64, osx_arm64) so the locally built icu is staged at the path autoload expects on every tested platform; the Linux mapping is unchanged. Co-Authored-By: Claude Opus 4.7 --- Makefile | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index ab8cf2ee..a9485498 100644 --- a/Makefile +++ b/Makefile @@ -15,16 +15,23 @@ include extension-ci-tools/makefiles/duckdb_extension.Makefile # LoadInternal also calls ExtensionHelper::AutoLoadExtension(db, "icu") so # the timezone option is honoured. Autoload looks for the extension on disk # at $HOME/.duckdb/extensions///icu.duckdb_extension -# and falls back to a hub download. Inside the linux_amd64 test docker -# container that path is empty and there is no network egress, so the -# autoload fails. We copy the icu.duckdb_extension that was built locally -# as part of this extension's build (declared in extension_config.cmake) -# into the expected path before running the unittester. +# and falls back to a hub download. That fails both inside the linux_amd64 +# test docker container (empty path, no network egress) and on the macOS +# osx_arm64 test runner (hub icu not reliably resolvable). We copy the +# icu.duckdb_extension that was built locally as part of this extension's +# build (declared in extension_config.cmake) into the expected path, +# matched to the DuckDB platform string, before running the unittester. DUCKDB_VERSION_TAG := v1.4.4 define stage_icu @if [ -f ./build/$(1)/extension/icu/icu.duckdb_extension ]; then \ - platform=$$(uname -m | sed 's/x86_64/linux_amd64/;s/aarch64/linux_arm64/'); \ + case "$$(uname -s)-$$(uname -m)" in \ + Linux-x86_64) platform=linux_amd64 ;; \ + Linux-aarch64) platform=linux_arm64 ;; \ + Darwin-arm64) platform=osx_arm64 ;; \ + Darwin-x86_64) platform=osx_amd64 ;; \ + *) platform=$$(uname -m) ;; \ + esac; \ target=$$HOME/.duckdb/extensions/$(DUCKDB_VERSION_TAG)/$$platform; \ mkdir -p "$$target" && cp -f ./build/$(1)/extension/icu/icu.duckdb_extension "$$target/" && \ echo "Staged icu.duckdb_extension at $$target/"; \ From 7e5e6dd7e8fd383f1f78f2a4799c66de4d1df66e Mon Sep 17 00:00:00 2001 From: Esteban Zimanyi Date: Wed, 20 May 2026 11:55:01 +0200 Subject: [PATCH 13/13] fix: drop premature `using meosType = MeosType;` alias in tydef.hpp MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `meosType` (lower-case) is the **pre-consolidation** MEOS type name; `MeosType` (upper-case) is the **post-consolidation** target that the upstream rename sweep has not yet reached. The current vcpkg pin (`vcpkg_ports/meos/portfile.cmake` REF f11b7443ee98…) is still pre-consolidation: `meos/include/temporal/meos_catalog.h` line 121 declares the typedef as `} meosType;` and every MEOS API uses the lower-case spelling. MobilityDuck's source code consistently uses `meosType` to match — `grep -rn '\bMeosType\b' src/` finds the name only on the alias line and its comment, nowhere else. c8cad6d added `using meosType = MeosType;` as a forward-looking bridge for the eventual consolidation bump. That bridge points at `MeosType`, which the current pin does NOT yet expose, so it breaks every PR's Linux arm64 build with: /duckdb_build_dir/src/include/tydef.hpp:18:18: error: ‘MeosType’ does not name a type; did you mean ‘meosType’? The fix is to drop the premature alias and replace the misleading comment with one that documents the pre/post-consolidation distinction and the resume path for the next pin bump — at that point a reviewer can either restore the bridge (this time it'll be valid because `MeosType` will exist) or sweep the MobilityDuck source from `meosType` to `MeosType` in a single PR. Unblocks every in-flight PR's Linux arm64 build: #126, #130, #149, #158, #159, #160, plus the entire `feat/*_port_core` extended-type stack (#148/#150/#151/#153/#155/#156). --- src/include/tydef.hpp | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/src/include/tydef.hpp b/src/include/tydef.hpp index b7b28109..b9860ca0 100644 --- a/src/include/tydef.hpp +++ b/src/include/tydef.hpp @@ -11,11 +11,27 @@ extern "C" { #include } -// Forward-compat alias for the meosType → MeosType rename (MobilityDB -// pr785-sync-script). Vcpkg's MEOS exposes `MeosType`; existing -// MobilityDuck code still uses `meosType`. This alias bridges the two -// without touching every reference site. -using meosType = MeosType; +// MEOS naming history: `meosType` is the **pre-consolidation** spelling +// and `MeosType` is the **post-consolidation** target (the rename is +// part of the upstream consolidation sweep, not yet reached by the +// vcpkg pin). The current pin +// (`vcpkg_ports/meos/portfile.cmake` REF f11b7443ee98…) is still +// pre-consolidation and exposes `meosType` — see +// meos/include/temporal/meos_catalog.h, where line 121 declares +// `} meosType;`. MobilityDuck's source consistently uses +// `meosType` (verified via `grep -rn '\bmeosType\b' src/`), which +// matches the pin, so no alias is needed today. +// +// An earlier version of this file added `using meosType = MeosType;` +// as a forward-looking bridge for the eventual consolidation bump. +// That alias references `MeosType`, which the current pin does NOT +// yet expose, so it broke the build: +// "'MeosType' does not name a type; did you mean 'meosType'?". +// +// When the MEOS pin is bumped past the consolidation point, restore +// a bridge here (`using meosType = MeosType;` becomes valid then) or +// sweep the source `meosType → MeosType` in one PR — whichever the +// project prefers at that time. namespace duckdb {