From f75d7c06363f0f46c2c6df178799301ce80e1fa9 Mon Sep 17 00:00:00 2001 From: Esteban Zimanyi Date: Fri, 9 Oct 2026 19:10:44 +0200 Subject: [PATCH] Check the constructors from an array of fixed-size values on the typed surface GeneratedSqlSurfaceTest.arraysCrossAsSparkArrays checks that spanset over an array of two int spans answers {[1, 3), [5, 7)}, and that set over three network points, one repeated, and over two circular buffers answers 2 values each: the elements reach MEOS as the contiguous C array spanset_make, npointset_make and cbufferset_make read. Witness: with the generator of JMEOS main the surface registers no spanset over an array of spans, and the test fails on "function spanset(array) does not exist". Measured over MobilityDB 2a1d52a7ee, the catalog of MEOS-API catalog/struct-value-input-arrays and the generator of JMEOS codegen/struct-value-arrays: the 35 tests pass. Why: a constructor from an array of values answers on Spark as it does in PostgreSQL. --- .../java/org/mobilitydb/spark/GeneratedSqlSurfaceTest.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/test/java/org/mobilitydb/spark/GeneratedSqlSurfaceTest.java b/src/test/java/org/mobilitydb/spark/GeneratedSqlSurfaceTest.java index 6668daf0..933eabd0 100644 --- a/src/test/java/org/mobilitydb/spark/GeneratedSqlSurfaceTest.java +++ b/src/test/java/org/mobilitydb/spark/GeneratedSqlSurfaceTest.java @@ -157,6 +157,13 @@ void arraysCrossAsSparkArrays() { + near + "))")); assertThrows(Exception.class, () -> scalar("SELECT intset_out(set(array(1, CAST(NULL AS INT))))")); + // An array of fixed-size values reaches MEOS as the contiguous C array it reads + assertEquals("{[1, 3), [5, 7)}", scalar("SELECT intspanset_out(spanset(array(" + + "intspan_in('[5, 7)'), intspan_in('[1, 3)'))))")); + assertEquals(2, scalar("SELECT numValues(set(array(npoint_in('NPoint(1, 0.5)'), " + + "npoint_in('NPoint(2, 0.3)'), npoint_in('NPoint(1, 0.5)'))))")); + assertEquals(2, scalar("SELECT numValues(set(array(cbuffer_in('Cbuffer(Point(1 1), 0.5)'), " + + "cbuffer_in('Cbuffer(Point(2 2), 1)'))))")); } @Test