From 756bbe2a3eb04ccbfacbb4fcd66c3558dbc84f8a Mon Sep 17 00:00:00 2001 From: Esteban Zimanyi Date: Fri, 30 Oct 2026 16:18:34 +0100 Subject: [PATCH] Test the nearest approach distance of a number span test/sql/parity/036_tnumber_distance_span.test states what an intspan, bigintspan or floatspan answers through |=| and nearestApproachDistance against a tbox and against the temporal number of its base type, in either order, the cases of MobilityDB's 036_tnumber_distance with the answers its harvested output gives; a box without the value dimension raises the error MobilityDB raises, and a span of another number than the box raises the error of nad_floatspan_tbox, the typed MEOS function DuckDB reaches, where MobilityDB refuses it in its PostgreSQL wrapper, as 025_temporal_tile_tiles.test states such a case. Witness: tbox 'TBOXINT XT([0,6),[2001-01-01,2001-01-03])' |=| intspan '[10,12)' is 5.0, and intspan '[10,12)' |=| tint '[0@2001-01-01, 5@2001-01-03]' and bigintspan '[10,12)' |=| tbigint '[0@2001-01-01, 5@2001-01-03]' are 5.0; intspan '[1,2)' |=| tbox 'TBOX T([2001-01-01,2001-01-02])' raises "The tbox must have X dimension". Measured: the file holds the 10 cases of MobilityDB master's span distance section, 8 queries and 2 errors, written from its harvested 036_tnumber_distance.test.out; the generated surface at MEOS 7a0117c238 registers the 24 forms MobilityDB declares over a number span, against 18 at 7fb8e5bd65, where the span-first forms against a temporal number are absent and the tbox-first forms read their tbox argument as a span. Why: no test read a span distance, so the 6 tbox-first forms answer from the wrong operand on main and the 6 span-first forms against a temporal number stay unregistered without one failing. --- .../sql/parity/036_tnumber_distance_span.test | 60 +++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 test/sql/parity/036_tnumber_distance_span.test diff --git a/test/sql/parity/036_tnumber_distance_span.test b/test/sql/parity/036_tnumber_distance_span.test new file mode 100644 index 00000000..125e8486 --- /dev/null +++ b/test/sql/parity/036_tnumber_distance_span.test @@ -0,0 +1,60 @@ +# name: test/sql/parity/036_tnumber_distance_span.test +# description: MobilityDB regression file 036_tnumber_distance.test.sql adapted for MobilityDuck +# group: [sql] +# +# The nearest approach distance of a number span to a temporal box or to a +# temporal number of its base type, in either order. + +require mobilityduck + +query I +SELECT intspan '[-5,-4)' |=| tbox 'TBOXINT XT([0,6),[2001-01-01,2001-01-03])'; +---- +5.0 + +query I +SELECT tbox 'TBOXINT XT([0,6),[2001-01-01,2001-01-03])' |=| intspan '[10,12)'; +---- +5.0 + +query I +SELECT floatspan '[-5,-4]' |=| tbox 'TBOXFLOAT X([0,5])'; +---- +4.0 + +query I +SELECT tint '[0@2001-01-01, 5@2001-01-03]' |=| intspan '[-5,-4)'; +---- +5.0 + +query I +SELECT intspan '[10,12)' |=| tint '[0@2001-01-01, 5@2001-01-03]'; +---- +5.0 + +query I +SELECT bigintspan '[10,12)' |=| tbigint '[0@2001-01-01, 5@2001-01-03]'; +---- +5.0 + +query I +SELECT tfloat '[0@2001-01-01, 5@2001-01-03]' |=| floatspan '[-5,-4]'; +---- +4.0 + +query I +SELECT nearestApproachDistance(intspan '[1,3)', tbox 'TBOXINT X([2,6))'); +---- +0.0 + +# MobilityDB refuses it in its PostgreSQL wrapper; DuckDB reaches +# nad_floatspan_tbox, whose MEOS validation refuses the integer box +statement error +SELECT floatspan '[1,2]' |=| tbox 'TBOXINT X([0,6))'; +---- +The span must be of type floatspan + +statement error +SELECT intspan '[1,2)' |=| tbox 'TBOX T([2001-01-01,2001-01-02])'; +---- +The tbox must have X dimension