From 1a5baba80ce65c1f2b1a152f1d6161ff7d757903 Mon Sep 17 00:00:00 2001 From: Esteban Zimanyi Date: Sat, 10 Oct 2026 02:01:57 +0200 Subject: [PATCH] Check the call that leaves an argument to its NULL default on the typed surface GeneratedSqlSurfaceTest.anArgumentLeftToItsNullDefaultIsWhatTheWrapperPasses checks that tintSeqSetGaps over three instants with a gap of three days answers 2 sequences with a one-day maxt and no maxdist, the wrapper passing -1.0, and 1 with neither, the wrapper passing a NULL maxt; and that tfloatSeq of an instant without an interpolation answers a sequence, the wrapper passing INTERP_NONE. Witness: with the generator of JMEOS main the surface registers no call of tintSeqSetGaps without its NULL-default arguments, and the test fails on "function tintSeqSetGaps(array, interval day) does not exist". Measured over MobilityDB 647acbe4ed, the catalog of MEOS-API catalog/null-default-binds and the generator of JMEOS codegen/null-default-arities: the 37 tests pass. Why: a call leaving an argument to its default answers on Spark as it does in PostgreSQL. --- .../mobilitydb/spark/GeneratedSqlSurfaceTest.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/test/java/org/mobilitydb/spark/GeneratedSqlSurfaceTest.java b/src/test/java/org/mobilitydb/spark/GeneratedSqlSurfaceTest.java index ba50dac8..d20fd64c 100644 --- a/src/test/java/org/mobilitydb/spark/GeneratedSqlSurfaceTest.java +++ b/src/test/java/org/mobilitydb/spark/GeneratedSqlSurfaceTest.java @@ -144,6 +144,21 @@ void textConstructorsAndOutput() { assertEquals(true, scalar("SELECT spanOverlaps(floatspan_in('[1, 3]'), floatspan_in('[2, 4]'))")); } + @Test + void anArgumentLeftToItsNullDefaultIsWhatTheWrapperPasses() { + // tintSeqSetGaps without maxdist splits on time alone (the wrapper's -1.0), and + // without maxt either it splits on nothing (the wrapper's NULL) + String instants = "array(tintFromText('1@2020-01-01'), tintFromText('2@2020-01-02'), " + + "tintFromText('3@2020-01-05'))"; + assertEquals(2, scalar("SELECT numSequences(tintSeqSetGaps(" + instants + + ", INTERVAL '1' DAY))")); + assertEquals(1, scalar("SELECT numSequences(tintSeqSetGaps(" + instants + "))")); + // tfloatSeq without an interpolation keeps the value's own (the wrapper's + // INTERP_NONE) and makes an instant a sequence + assertEquals("Sequence", scalar("SELECT tempSubtype(tfloatSeq(" + + "tfloatFromText('1@2020-01-01')))")); + } + @Test void anOmittedInterpolationIsTheOneOfTheType() { // appendInstant and the sequence set constructors without an interpolation take the