From 010b9f7c96bae0d56f1371303f5ccddbadaf3775 Mon Sep 17 00:00:00 2001 From: Esteban Zimanyi Date: Mon, 28 Sep 2026 16:21:02 +0200 Subject: [PATCH] State the codec each Spark value travels in, a box's among them The generated surface carries a value in the codec the MEOS catalog states for its type: temporal values, spans, span sets, sets, boxes, circular buffers, network points and poses as their WKB bytes, read as well from their hex-WKB text and, for a type with a generic text reader, from their text form; geometries as EWKT, read from WKT or EWKT; network segments and JSON as their text form. The README states that rule, and values_travel_as_wkb_and_hex_wkb_stays_readable reads a box back as byte[], writes it out as its text, and answers hasZ over its text literal. Witness. The box check fails on the generator of JMEOS 04e0a71e, whose boxes travel as text: a box travels as WKB, got class java.lang.String. Measured. Against JMEOS main e47aa744, the catalog and libmeos of MobilityDB 438528db44 with MEOS-API 20efba81be and the jar JMEOS builds from them, the suite runs 21 tests, all passing. Why. The README and the test state the form each value takes, so the codec the catalog decides reaches the suite and the reader of the binding alike. --- README.md | 8 +++++--- .../java/org/mobilitydb/spark/GeneratedSurfaceTest.java | 6 ++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 6c0e1d6..560995f 100644 --- a/README.md +++ b/README.md @@ -104,9 +104,11 @@ SparkSession spark = SparkSession.builder().appName("mobilityspark").master("loc GeneratedSpatioTemporalUDFs.registerAll(spark); ``` -Temporal values, spans, span sets and sets travel as their MEOS WKB bytes, a binary column, and a -column of their hex-WKB text reads as well; geometries travel as WKT or EWKT text, and boxes, -circular buffers, network points and poses as their text form: +A value travels in the codec the MEOS catalog states for its type: temporal values, spans, span +sets, sets, boxes, circular buffers, network points and poses as their MEOS WKB bytes, a binary +column, read as well from their hex-WKB text and, for a type with a generic text reader such as a +box, from their text form; geometries travel as EWKT and are read from WKT or EWKT, and network +segments and JSON as their text form: ```sql -- accessors under their canonical MobilityDB SQL names diff --git a/src/test/java/org/mobilitydb/spark/GeneratedSurfaceTest.java b/src/test/java/org/mobilitydb/spark/GeneratedSurfaceTest.java index 10b7fbb..ed40468 100644 --- a/src/test/java/org/mobilitydb/spark/GeneratedSurfaceTest.java +++ b/src/test/java/org/mobilitydb/spark/GeneratedSurfaceTest.java @@ -283,6 +283,12 @@ void values_travel_as_wkb_and_hex_wkb_stays_readable() { assertTrue(t instanceof byte[], "a temporal travels as WKB, got " + t.getClass()); Object span = scalar("SELECT timeSpan(" + tint + ")"); assertTrue(span instanceof byte[], "a span travels as WKB, got " + span.getClass()); + // A box travels as its WKB bytes too, and is read from those bytes and from its text. + String box = "'STBOX X((1,1),(2,2))'"; + Object stbox = scalar("SELECT stbox_in(" + box + ")"); + assertTrue(stbox instanceof byte[], "a box travels as WKB, got " + stbox.getClass()); + assertEquals("STBOX X((1,1),(2,2))", scalar("SELECT stbox_out(stbox_in(" + box + "), 15)")); + assertEquals(Boolean.FALSE, scalar("SELECT hasZ(" + box + ")")); // The bytes and the hex-WKB text of one value answer alike. assertEquals(3, ((Number) scalar("SELECT numInstants(" + tint + ")")).intValue()); assertEquals(3, ((Number) scalar("SELECT numInstants('" + TINT_HEX + "')")).intValue());