From 85e36c01e470463c8fef7b8f858382210b3f032d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20Zim=C3=A1nyi?= Date: Fri, 9 Oct 2026 23:48:39 +0200 Subject: [PATCH] Check the interpolation an omitted argument takes on the typed surface GeneratedSqlSurfaceTest.anOmittedInterpolationIsTheOneOfTheType checks that appendInstant and tintSeqSetGaps, called without an interpolation, take the one the temporal type supports: appending 5 to a tfloat from 1 to 2 keeps 3 instants and appending 3 keeps 2, the middle one on the line of its neighbours, while appending 3 to a tint keeps 3; interp answers Linear and Step; and tintSeqSetGaps splits three instants with a gap of three days into 2 sequences. Witness: over the catalog of MEOS-API f8f63bd the surface registers no appendInstant over two temporal values, as MobilitySpark #72 measures on the twin test, which fails there on "function appendInstant(tfloat, tfloat) does not exist". Measured over MobilityDB a0480a7d38 and the catalog of MEOS-API catalog/interp-from-signature-type, which #184 merges, with the generator of JMEOS 88694368: the binding module passes its 22 tests and the benchmark module its 12, and the build prints no warning. Why: appendInstant and the sequence set constructors answer on Flink as they do in PostgreSQL. --- .../flink/sql/GeneratedSqlSurfaceTest.java | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/binding/src/test/java/org/mobilitydb/flink/sql/GeneratedSqlSurfaceTest.java b/binding/src/test/java/org/mobilitydb/flink/sql/GeneratedSqlSurfaceTest.java index b4eb401..9dfe546 100644 --- a/binding/src/test/java/org/mobilitydb/flink/sql/GeneratedSqlSurfaceTest.java +++ b/binding/src/test/java/org/mobilitydb/flink/sql/GeneratedSqlSurfaceTest.java @@ -136,6 +136,29 @@ private static String tgeompoint(String text) { + TGeomPoint.encode(GeneratedFunctions.tgeompoint_in(text)).toString() + "')"; } + @Test + void anOmittedInterpolationIsTheOneOfTheType() throws Exception { + // appendInstant and the sequence set constructors without an interpolation take the + // one the temporal type supports: linear for a tfloat, step for a tint. A linear + // sequence drops an instant on the line of its neighbours, a step one keeps it. + String tfloat = "tfloatFromText('[1@2020-01-01, 2@2020-01-02]')"; + String tint = "tintFromText('[1@2020-01-01, 2@2020-01-02]')"; + assertEquals(3, scalar("SELECT numInstants(appendInstant(" + tfloat + + ", tfloatFromText('5@2020-01-03')))")); + assertEquals(2, scalar("SELECT numInstants(appendInstant(" + tfloat + + ", tfloatFromText('3@2020-01-03')))")); + assertEquals(3, scalar("SELECT numInstants(appendInstant(" + tint + + ", tintFromText('3@2020-01-03')))")); + assertEquals("Linear", scalar("SELECT interp(appendInstant(" + tfloat + + ", tfloatFromText('5@2020-01-03')))")); + assertEquals("Step", scalar("SELECT interp(appendInstant(" + tint + + ", tintFromText('3@2020-01-03')))")); + // a gap of more than a day between instants starts a new sequence + assertEquals(2, scalar("SELECT numSequences(tintSeqSetGaps(ARRAY[" + + "tintFromText('1@2020-01-01'), tintFromText('2@2020-01-02'), " + + "tintFromText('3@2020-01-05')], INTERVAL '1' DAY, CAST(100.0 AS DOUBLE)))")); + } + @Test void arraysCrossAsFlinkArrays() throws Exception { assertEquals("{1, 2, 3}", scalar("SELECT intset_out(`set`(ARRAY[3, 1, 2]))"));