From 4beb32725cace468bd7c9cdfa54fd0e2e509519c Mon Sep 17 00:00:00 2001 From: Esteban Zimanyi Date: Thu, 28 May 2026 21:32:54 +0200 Subject: [PATCH 1/8] Bump pinned MEOS to upstream master and adapt to the renamed/orthogonalized API Pin MEOS at MobilityDB/MobilityDB 2c4243a265 and adapt the binding to that surface: the spatial-relationship functions drop their restr/at_value arguments and become 2-arg, the temporal multiplication MEOS calls move from mult_* to mul_*, temptype_continuous becomes temptype_supports_linear, and the rtree module follows the MeosType/MeosArray bbox API. MeosType is used directly in headers where the forward-compat alias is not visible. --- src/geo/tgeogpoint.cpp | 117 --------- src/geo/tgeogpoint_ops.cpp | 24 +- src/geo/tgeography_ops.cpp | 24 +- src/geo/tgeometry_ops.cpp | 24 +- src/geo/tgeompoint.cpp | 144 ++-------- src/geo/tgeompoint_functions.cpp | 274 ++++++-------------- 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/index/rtree_module.cpp | 42 ++- 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 | 56 ++-- test/sql/tgeompoint.test | 8 +- vcpkg_ports/meos/portfile.cmake | 4 +- 25 files changed, 282 insertions(+), 625 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/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); 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..d063f23f 100644 --- a/src/geo/tgeompoint_functions.cpp +++ b/src/geo/tgeompoint_functions.cpp @@ -454,8 +454,8 @@ 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; + 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; @@ -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/src/include/index/rtree_module.hpp b/src/include/index/rtree_module.hpp index 5cb45811..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_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/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/index/rtree_module.cpp b/src/index/rtree_module.cpp index d05e4be8..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_) { @@ -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_meostype == T_STBOX) { supported_functions = {"&&"}; - } else if (bbox_type_ == T_TSTZSPAN) { + } else if (bbox_meostype == 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_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; 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 7e5cc932..fc8a2b68 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,8 +243,8 @@ 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()); - interpType interp = temptype_continuous(temptype) ? LINEAR : STEP; + 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,8 +515,8 @@ 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()); - interpType interp = temptype_continuous(temptype) ? LINEAR : STEP; + 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]; interp_child.Flatten(count); @@ -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,8 +598,8 @@ 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()); - interpType interp = temptype_continuous(temptype) ? LINEAR : STEP; + 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]; interp_child.Flatten(count); @@ -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,8 +2416,8 @@ 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; + 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]; interp_child.Flatten(count); @@ -4757,19 +4757,19 @@ void TemporalFunctions::Sub_tnumber_tnumber(DataChunk &args, ExpressionState &st } void TemporalFunctions::Mult_int_tint(DataChunk &args, ExpressionState &state, Vector &result) { - TemporalBinaryV1(args, result, [](int32_t i, Temporal *t) { return mult_int_tint(i, t); }); + TemporalBinaryV1(args, result, [](int32_t i, Temporal *t) { return mul_int_tint(i, t); }); } void TemporalFunctions::Mult_tint_int(DataChunk &args, ExpressionState &state, Vector &result) { - TemporalBinaryV(args, result, [](Temporal *t, int32_t i) { return mult_tint_int(t, i); }); + TemporalBinaryV(args, result, [](Temporal *t, int32_t i) { return mul_tint_int(t, i); }); } void TemporalFunctions::Mult_float_tfloat(DataChunk &args, ExpressionState &state, Vector &result) { - TemporalBinaryV1(args, result, [](double d, Temporal *t) { return mult_float_tfloat(d, t); }); + TemporalBinaryV1(args, result, [](double d, Temporal *t) { return mul_float_tfloat(d, t); }); } void TemporalFunctions::Mult_tfloat_float(DataChunk &args, ExpressionState &state, Vector &result) { - TemporalBinaryV(args, result, [](Temporal *t, double d) { return mult_tfloat_float(t, d); }); + TemporalBinaryV(args, result, [](Temporal *t, double d) { return mul_tfloat_float(t, d); }); } void TemporalFunctions::Mult_tnumber_tnumber(DataChunk &args, ExpressionState &state, Vector &result) { - TemporalBinaryTT(args, result, [](Temporal *a, Temporal *b) { return mult_tnumber_tnumber(a, b); }); + TemporalBinaryTT(args, result, [](Temporal *a, Temporal *b) { return mul_tnumber_tnumber(a, b); }); } void TemporalFunctions::Div_int_tint(DataChunk &args, ExpressionState &state, Vector &result) { @@ -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; 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 diff --git a/vcpkg_ports/meos/portfile.cmake b/vcpkg_ports/meos/portfile.cmake index 2a2a5614..2a99eef5 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 2c4243a265 + SHA512 36d88c3a925d8c38a540c651fa74d127565985bcad79191344f2e93cb0de54e8f8efb84ef308595f8c4c122f1047e6b9d9696cff47bbc56ae9d0b4b807c7ab02 ) vcpkg_replace_string( From 880d8d95b12174cd1cb0fc97a56730377bfe3db9 Mon Sep 17 00:00:00 2001 From: Esteban Zimanyi Date: Fri, 29 May 2026 17:40:50 +0200 Subject: [PATCH 2/8] Degrade gracefully when ICU is unavailable and stage it for tests LoadInternal auto-loads ICU for the named Europe/Brussels zone; when ICU has no on-disk copy and no network egress (CI test docker, edge/musl, offline) the auto-load is caught so the extension still loads with the session timezone at its default. The release/debug/reldebug test targets stage the locally-built icu.duckdb_extension into the version/platform path DuckDB autoloads from. --- Makefile | 35 ++++++++++++++++++++++++++++++++++ src/mobilityduck_extension.cpp | 25 +++++++++++++++++++----- 2 files changed, 55 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index bc17d050..6ee08484 100644 --- a/Makefile +++ b/Makefile @@ -11,9 +11,44 @@ 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 auto-loads ICU so the named "Europe/Brussels" zone resolves. +# DuckDB autoloads ICU from +# $HOME/.duckdb/extensions///icu.duckdb_extension +# and otherwise falls back to a hub download — which fails inside the CI test +# docker (empty path, no network egress). So we stage the locally-built ICU +# into the expected path before the unittester runs. Version and platform are +# derived from the freshly-built duckdb binary (authoritative); the +# DUCKDB_VERSION_TAG and uname map are fallbacks only. +DUCKDB_VERSION_TAG := v1.4.4 + +define stage_icu + @if [ -f ./build/$(1)/extension/icu/icu.duckdb_extension ]; then \ + duckdb_bin=./build/$(1)/duckdb; \ + version_tag=$$( [ -x "$$duckdb_bin" ] && "$$duckdb_bin" --version 2>/dev/null | grep -oE 'v[0-9]+\.[0-9]+\.[0-9]+' | head -1 ); \ + platform=$$( [ -x "$$duckdb_bin" ] && echo 'PRAGMA platform;' | "$$duckdb_bin" -noheader -list 2>/dev/null | tr -d '[:space:]' ); \ + [ -n "$$version_tag" ] || version_tag=$(DUCKDB_VERSION_TAG); \ + if [ -z "$$platform" ]; then \ + 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; \ + fi; \ + target=$$HOME/.duckdb/extensions/$$version_tag/$$platform; \ + mkdir -p "$$target" && cp -f ./build/$(1)/extension/icu/icu.duckdb_extension "$$target/" && \ + echo "Staged icu.duckdb_extension at $$target/ (duckdb $$version_tag / $$platform)"; \ + 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: + $(call stage_icu,reldebug) ./build/reldebug/$(TEST_PATH) "$(PROJ_DIR)test/*" \ No newline at end of file diff --git a/src/mobilityduck_extension.cpp b/src/mobilityduck_extension.cpp index 0eb7ebd4..f6d3422f 100644 --- a/src/mobilityduck_extension.cpp +++ b/src/mobilityduck_extension.cpp @@ -34,6 +34,7 @@ #include #include #include +#include #include #if defined(_WIN32) @@ -227,12 +228,26 @@ static void LoadInternal(ExtensionLoader &loader) { // Single-timezone model: ensure DuckDB's session timezone matches the // MEOS timezone so bare TIMESTAMPTZ display agrees with MEOS composite - // type strings. Auto-load ICU (without it, the test framework keeps - // session timezone at UTC) and set the TimeZone option to Brussels. + // type strings. This needs ICU for the named "Europe/Brussels" zone. + // + // If ICU cannot be auto-loaded (no on-disk copy AND no network egress: + // CI docker images, edge/musl deployments, offline installs), degrade + // gracefully to the session default instead of failing the whole + // extension load. Tests that assert Brussels display stage ICU locally + // via the Makefile's stage_icu. auto &db = loader.GetDatabaseInstance(); - ExtensionHelper::AutoLoadExtension(db, "icu"); - auto &config = DBConfig::GetConfig(db); - config.SetOptionByName("TimeZone", Value("Europe/Brussels")); + try { + ExtensionHelper::AutoLoadExtension(db, "icu"); + auto &config = DBConfig::GetConfig(db); + config.SetOptionByName("TimeZone", Value("Europe/Brussels")); + } catch (const std::exception &e) { + // ICU unavailable: leave the session timezone at its default. + // Temporal-type text I/O is unaffected; only bare TIMESTAMPTZ display + // falls back to UTC. + fprintf(stderr, + "mobilityduck: ICU not available (%s); session timezone left " + "at default instead of Europe/Brussels.\n", e.what()); + } // Register scalar function: mobilityduck_openssl_version From 7b85d06745ab6b54fd5788cf37597b055f5cabc7 Mon Sep 17 00:00:00 2001 From: Esteban Zimanyi Date: Fri, 29 May 2026 18:17:36 +0200 Subject: [PATCH 3/8] Initialize MEOS per worker thread DuckDB runs scalar and cast bodies on TaskScheduler worker threads; MEOS keeps the session timezone, errno, PROJ context and RNGs in thread-local storage and needs meos_initialize() on each thread before first use. A thread-local guard in the scalar exec wrapper and a cast trampoline run the per-thread init (and re-install the error handler) at every entry point, so timestamp formatting on a worker no longer dereferences a NULL session_timezone. --- 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..05ab1a6a 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..3b667360 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..692d0426 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..bb3b1af4 100644 --- a/src/geo/tgeogpoint_in_out.cpp +++ b/src/geo/tgeogpoint_in_out.cpp @@ -1,5 +1,6 @@ #include "geo/tgeogpoint.hpp" #include "geo/tgeogpoint_functions.hpp" +#include "mobilityduck/meos_exec_serial.hpp" #include "duckdb/main/extension/extension_loader.hpp" #include "duckdb/common/extension_type_info.hpp" #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..2920f3a7 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..7733b4e9 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..7111d6b8 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..814489e3 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..b0855c09 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..aa6f0d07 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..48b03966 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..e154afc0 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 a465ddd3a218cbf9f64350e57b6b79b998d050be Mon Sep 17 00:00:00 2001 From: Esteban Zimanyi Date: Fri, 29 May 2026 19:25:41 +0200 Subject: [PATCH 4/8] Pin MEOS with deterministic ln/exp/log10 turning point and refresh expected The tfloat ln/exp/log10 lifts insert one chord-error turning point on a linear segment; the MEOS pin computes it in double so the inserted instant is identical on every platform, and the 026b expected carries the three-instant result. --- test/sql/parity/026b_tnumber_mathfuncs_followups.test | 10 ++++++---- vcpkg_ports/meos/portfile.cmake | 6 +++--- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/test/sql/parity/026b_tnumber_mathfuncs_followups.test b/test/sql/parity/026b_tnumber_mathfuncs_followups.test index 64027f7a..1be3f23d 100644 --- a/test/sql/parity/026b_tnumber_mathfuncs_followups.test +++ b/test/sql/parity/026b_tnumber_mathfuncs_followups.test @@ -6,22 +6,24 @@ 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. +# Each lift inserts one chord-error-minimising turning point on the linear +# input segment, 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 diff --git a/vcpkg_ports/meos/portfile.cmake b/vcpkg_ports/meos/portfile.cmake index 2a99eef5..82619e3a 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 2c4243a265 - SHA512 36d88c3a925d8c38a540c651fa74d127565985bcad79191344f2e93cb0de54e8f8efb84ef308595f8c4c122f1047e6b9d9696cff47bbc56ae9d0b4b807c7ab02 + REPO estebanzimanyi/MobilityDB + REF a8178dc9d56d841d0eb5025a7e8717c8d25a1d0f + SHA512 030a144bb3247695702dd2de11f4c389ed28c6eb0186e6988a489e2b00e9801179ba8f27bcbcd81ae89e398a7277ed7f9ff7058dbf15f5db322ae4644365c560 ) vcpkg_replace_string( From d0a70ae7e02bef069a471881382a235636e4f622 Mon Sep 17 00:00:00 2001 From: Esteban Zimanyi Date: Fri, 29 May 2026 21:34:49 +0200 Subject: [PATCH 5/8] 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 a Set *(*)(int64_t) non-type template argument. A forwarder that casts int64_t to int64 fixes the macOS build; the cast is a no-op on Linux. --- src/temporal/set.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/temporal/set.cpp b/src/temporal/set.cpp index 814489e3..912b7317 100644 --- a/src/temporal/set.cpp +++ b/src/temporal/set.cpp @@ -945,6 +945,13 @@ 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 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. +static inline Set *bigint_to_set_duckdb(int64_t i) { + return bigint_to_set(static_cast(i)); +} + struct SetPtrState { Set *accumulated; }; @@ -1069,7 +1076,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: Fri, 29 May 2026 22:09:16 +0200 Subject: [PATCH 6/8] Pin MEOS with the wasm pg_config SIZEOF_LONG_LONG fix Adds the SIZEOF_LONG_LONG emission to the rendered pg_config.h so the DuckDB-Wasm (wasm32-emscripten / ILP32) build of MEOS no longer fails the pg_bitutils integer-width check. --- vcpkg_ports/meos/portfile.cmake | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/vcpkg_ports/meos/portfile.cmake b/vcpkg_ports/meos/portfile.cmake index 82619e3a..b1760990 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 estebanzimanyi/MobilityDB - REF a8178dc9d56d841d0eb5025a7e8717c8d25a1d0f - SHA512 030a144bb3247695702dd2de11f4c389ed28c6eb0186e6988a489e2b00e9801179ba8f27bcbcd81ae89e398a7277ed7f9ff7058dbf15f5db322ae4644365c560 + REF 345710da851b16c5c34647b1c37de1ef6655ba61 + SHA512 a42d90bbdd35f59d322014c4ccd6f715cd52772e93c28ee53f973c4c0e72920a596bb8d5a9e74041b58331b3d6ce9e9f223b113877f1c8ce7eda456cba5a7243 ) vcpkg_replace_string( @@ -22,6 +22,9 @@ vcpkg_cmake_configure( OPTIONS -DMEOS=ON -DBUILD_SHARED_LIBS=ON + # Build only the MEOS library, not the MEOS C test binaries: those link + # the GEOS C++ API, which the arm64-linux vcpkg triplet does not carry. + -DBUILD_TESTING=OFF -DCMAKE_C_FLAGS="-Dsession_timezone=meos_session_timezone" -DCMAKE_CXX_FLAGS="-Dsession_timezone=meos_session_timezone" From 77f3e86238f59b70352c5ac8a0e5fe311995da95 Mon Sep 17 00:00:00 2001 From: Esteban Zimanyi Date: Tue, 2 Jun 2026 12:31:38 +0200 Subject: [PATCH 7/8] Adapt to the struct-returning split and count-out-param MEOS API The pinned MEOS returns TimeSplit / DatumSplit / IntSplit / FloatSplit / SpaceSplit / SpaceTimeSplit / MvtGeom structs from the split and as-mvtgeom functions, and set_vals / set_spans / spanset_spans take an int* count out-parameter. Adapt the temporal, tgeompoint, set, span and spanset table/scalar functions to the struct fields and the extra out-parameter. --- src/geo/tgeompoint.cpp | 26 ++++++++++++++++---------- src/temporal/set_functions.cpp | 3 ++- src/temporal/span_functions.cpp | 3 ++- src/temporal/spanset_functions.cpp | 3 ++- src/temporal/temporal.cpp | 26 ++++++++++++++++---------- 5 files changed, 38 insertions(+), 23 deletions(-) diff --git a/src/geo/tgeompoint.cpp b/src/geo/tgeompoint.cpp index 7111d6b8..64304299 100644 --- a/src/geo/tgeompoint.cpp +++ b/src/geo/tgeompoint.cpp @@ -1936,12 +1936,12 @@ void TgeoAsMVTGeomExec(DataChunk &args, ExpressionState &state, Vector &result) if (cc > 3) buffer = FlatVector::GetData(args.data[3])[row]; if (cc > 4) clip = FlatVector::GetData(args.data[4])[row]; - GSERIALIZED *geom = nullptr; - int64 *times = nullptr; - int count = 0; - bool found = tpoint_as_mvtgeom(t, bx, extent, buffer, clip, &geom, ×, &count); + MvtGeom mvt = tpoint_as_mvtgeom(t, bx, extent, buffer, clip); + GSERIALIZED *geom = mvt.geom; + int64 *times = mvt.times; + int count = mvt.count; free(t); free(bx); - if (!found || !geom) { + if (!geom) { out_validity.SetInvalid(row); times_entries[row] = list_entry_t{total_times, 0}; if (geom) free(geom); @@ -2120,12 +2120,18 @@ unique_ptr SpaceSplitInitCommon(ClientContext &context if (bind.has_torigin) { torigin = (TimestampTz) DuckDBToMeosTimestamp(bind.torigin).value; } - trajs = tgeo_space_time_split(temp, bind.xsize, bind.ysize, bind.zsize, - &mi, origin, torigin, bind.bitmatrix, true, - &bins, &tbins, &count); + SpaceTimeSplit stsplit = tgeo_space_time_split(temp, bind.xsize, bind.ysize, bind.zsize, + &mi, origin, torigin, bind.bitmatrix, true); + trajs = stsplit.fragments; + bins = stsplit.space_bins; + tbins = stsplit.time_bins; + count = stsplit.count; } else { - trajs = tgeo_space_split(temp, bind.xsize, bind.ysize, bind.zsize, - origin, bind.bitmatrix, true, &bins, &count); + SpaceSplit ssplit = tgeo_space_split(temp, bind.xsize, bind.ysize, bind.zsize, + origin, bind.bitmatrix, true); + trajs = ssplit.fragments; + bins = ssplit.bins; + count = ssplit.count; } free(temp); free(origin); diff --git a/src/temporal/set_functions.cpp b/src/temporal/set_functions.cpp index a923401b..aab1aafe 100644 --- a/src/temporal/set_functions.cpp +++ b/src/temporal/set_functions.cpp @@ -893,7 +893,8 @@ void SetFunctions::Set_values(DataChunk &args, ExpressionState &state, Vector &r } uint64_t count = s->count; - Datum *values = set_vals(s); + int nvals = 0; + Datum *values = set_vals(s, &nvals); ListVector::SetListSize(result, total_offset + count); list_entries[i] = list_entry_t{total_offset, count}; diff --git a/src/temporal/span_functions.cpp b/src/temporal/span_functions.cpp index 2f78bacd..b95c08de 100644 --- a/src/temporal/span_functions.cpp +++ b/src/temporal/span_functions.cpp @@ -516,7 +516,8 @@ void SpanFunctions::Set_spans(DataChunk &args, ExpressionState &state, Vector &r memcpy(s, blob.GetData(), blob.GetSize()); int num = set_num_values(s); - Span *spans = set_spans(s); + int nspans = 0; + Span *spans = set_spans(s, &nspans); free(s); if (!spans || num <= 0) { diff --git a/src/temporal/spanset_functions.cpp b/src/temporal/spanset_functions.cpp index 5c88b75c..47d5a16c 100644 --- a/src/temporal/spanset_functions.cpp +++ b/src/temporal/spanset_functions.cpp @@ -1654,7 +1654,8 @@ void SpansetFunctions::Spanset_spans(DataChunk &args, ExpressionState &state, Ve memcpy(s, blob.GetData(), blob.GetSize()); int num = spanset_num_spans(s); - Span *spans = spanset_spans(s); + int nspans = 0; + Span *spans = spanset_spans(s, &nspans); free(s); if (!spans || num <= 0) { diff --git a/src/temporal/temporal.cpp b/src/temporal/temporal.cpp index e154afc0..9abf2973 100644 --- a/src/temporal/temporal.cpp +++ b/src/temporal/temporal.cpp @@ -2546,9 +2546,10 @@ unique_ptr TimeSplitInit(ClientContext &, TableFunctio ? static_cast(DuckDBToMeosTimestamp(bd.torigin).value) : TimestampTz(0); - int count = 0; - TimestampTz *tbins = nullptr; - Temporal **parts = temporal_time_split(t, &mi, torigin, &tbins, &count); + TimeSplit split = temporal_time_split(t, &mi, torigin); + Temporal **parts = split.fragments; + TimestampTz *tbins = split.bins; + int count = split.count; free(t); if (!parts || count <= 0) { @@ -2633,9 +2634,10 @@ unique_ptr ValueSplitInit(ClientContext &, TableFuncti Temporal *t = static_cast(malloc(bd.temp_blob.size())); memcpy(t, bd.temp_blob.data(), bd.temp_blob.size()); - int count = 0; - Datum *vbins = nullptr; - Temporal **parts = tnumber_value_split(t, bd.vsize, bd.vorigin, &vbins, &count); + DatumSplit vsplit = tnumber_value_split(t, bd.vsize, bd.vorigin); + Temporal **parts = vsplit.fragments; + Datum *vbins = vsplit.bins; + int count = vsplit.count; free(t); if (!parts || count <= 0) { @@ -2903,8 +2905,10 @@ static unique_ptr TnumberValueSplitInit(ClientContext int count = 0; Temporal **slices = nullptr; if (bind.temptype == T_TINT) { - int *bins_int = nullptr; - slices = tint_value_split(temp, (int)bind.size, (int)bind.origin, &bins_int, &count); + IntSplit isplit = tint_value_split(temp, (int)bind.size, (int)bind.origin); + slices = isplit.fragments; + int *bins_int = isplit.bins; + count = isplit.count; for (int i = 0; i < count; ++i) { state->rows.emplace_back(Value::BIGINT((int64_t)bins_int[i]), make_slice_value(slices[i])); free(slices[i]); @@ -2912,8 +2916,10 @@ static unique_ptr TnumberValueSplitInit(ClientContext free(slices); free(bins_int); } else if (bind.temptype == T_TFLOAT) { - double *bins_dbl = nullptr; - slices = tfloat_value_split(temp, bind.size, bind.origin, &bins_dbl, &count); + FloatSplit fsplit = tfloat_value_split(temp, bind.size, bind.origin); + slices = fsplit.fragments; + double *bins_dbl = fsplit.bins; + count = fsplit.count; for (int i = 0; i < count; ++i) { state->rows.emplace_back(Value::DOUBLE(bins_dbl[i]), make_slice_value(slices[i])); free(slices[i]); From e5d0464adcb01db7bd7bfa8d5f4190827d5ca65c Mon Sep 17 00:00:00 2001 From: Esteban Zimanyi Date: Fri, 5 Jun 2026 16:10:07 +0200 Subject: [PATCH 8/8] Bump pinned MEOS to 278863520b and adapt to its surface Pin MEOS to the canonical ecosystem surface and adapt the binding to it: treat a shared span boundary as adjacency (the share-a-boundary span adjacency goldens), and derive the symmetric box/span x temporal topological predicates (overlaps/same/adjacent) from MEOS's single canonical argument direction by commutativity, since the reverse-argument duplicates are deduplicated out of the surface. --- src/include/meos_wrapper_simple.hpp | 21 ++++++++++++++++++++- test/sql/parity/005_span_ops.test | 4 ++-- test/sql/parity/032_temporal_topops.test | 2 +- vcpkg_ports/meos/portfile.cmake | 4 ++-- 4 files changed, 25 insertions(+), 6 deletions(-) diff --git a/src/include/meos_wrapper_simple.hpp b/src/include/meos_wrapper_simple.hpp index 5b558be1..a4f13a93 100644 --- a/src/include/meos_wrapper_simple.hpp +++ b/src/include/meos_wrapper_simple.hpp @@ -10,7 +10,26 @@ extern "C" { #include } +// The symmetric box/span × temporal topological predicates (overlaps, same, +// adjacent) are canonicalized in MEOS to a single argument direction +// (temporal-first). The reverse-argument overloads the DuckDB surface exposes +// derive from that one kernel by commutativity (swap the operands). The +// non-symmetric predicates (contains/contained/overbefore/overafter) keep both +// MEOS directions and are used directly. +static inline bool overlaps_tstzspan_temporal(const Span *s, const Temporal *t) { return overlaps_temporal_tstzspan(t, s); } +static inline bool same_tstzspan_temporal (const Span *s, const Temporal *t) { return same_temporal_tstzspan(t, s); } +static inline bool adjacent_tstzspan_temporal(const Span *s, const Temporal *t) { return adjacent_temporal_tstzspan(t, s); } +static inline bool overlaps_stbox_tspatial(const STBox *b, const Temporal *t) { return overlaps_tspatial_stbox(t, b); } +static inline bool same_stbox_tspatial (const STBox *b, const Temporal *t) { return same_tspatial_stbox(t, b); } +static inline bool adjacent_stbox_tspatial(const STBox *b, const Temporal *t) { return adjacent_tspatial_stbox(t, b); } +static inline bool overlaps_numspan_tnumber(const Span *s, const Temporal *t) { return overlaps_tnumber_numspan(t, s); } +static inline bool same_numspan_tnumber (const Span *s, const Temporal *t) { return same_tnumber_numspan(t, s); } +static inline bool adjacent_numspan_tnumber(const Span *s, const Temporal *t) { return adjacent_tnumber_numspan(t, s); } +static inline bool overlaps_tbox_tnumber(const TBox *b, const Temporal *t) { return overlaps_tnumber_tbox(t, b); } +static inline bool same_tbox_tnumber (const TBox *b, const Temporal *t) { return same_tnumber_tbox(t, b); } +static inline bool adjacent_tbox_tnumber(const TBox *b, const Temporal *t) { return adjacent_tnumber_tbox(t, b); } + // Create explicit aliases for MEOS types // Use the original MEOS type names but with explicit qualification using MeosInterval = ::Interval; // Explicitly use global MEOS Interval -using MeosTimestamp = ::Timestamp; // Explicitly use global MEOS Timestamp +using MeosTimestamp = ::Timestamp; // Explicitly use global MEOS Timestamp diff --git a/test/sql/parity/005_span_ops.test b/test/sql/parity/005_span_ops.test index 1c8beb1a..42036a46 100644 --- a/test/sql/parity/005_span_ops.test +++ b/test/sql/parity/005_span_ops.test @@ -49,7 +49,7 @@ true query I SELECT 1.0 -|- floatspan '[1, 3]'; ---- -false +true query I SELECT 1.0 -|- floatspan '(1, 3]'; @@ -59,7 +59,7 @@ true query I SELECT floatspan '[1, 3]' -|- 1.0; ---- -false +true query I SELECT floatspan '[1, 3]' -|- floatspan '[1, 3]'; diff --git a/test/sql/parity/032_temporal_topops.test b/test/sql/parity/032_temporal_topops.test index 1a4df71d..dc0ef874 100644 --- a/test/sql/parity/032_temporal_topops.test +++ b/test/sql/parity/032_temporal_topops.test @@ -46,4 +46,4 @@ true query I SELECT tint '[1@2000-01-01, 5@2000-01-05]' -|- tstzspan '[2000-01-05, 2000-01-06]'; ---- -false +true diff --git a/vcpkg_ports/meos/portfile.cmake b/vcpkg_ports/meos/portfile.cmake index b1760990..f4de1fab 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 estebanzimanyi/MobilityDB - REF 345710da851b16c5c34647b1c37de1ef6655ba61 - SHA512 a42d90bbdd35f59d322014c4ccd6f715cd52772e93c28ee53f973c4c0e72920a596bb8d5a9e74041b58331b3d6ce9e9f223b113877f1c8ce7eda456cba5a7243 + REF 278863520b000b735cc361beab88387174909ed7 + SHA512 2e617cac4bfed919eee8bd73e35f9b3da8ffd7a51f68104a9497c0d3339dbb1af4a2ec6feab3e8fffb880481badf86c352ad1efb39cab533de19d2c1192a8e5b ) vcpkg_replace_string(