From eadf432b4b6316f29bcbbe9b172ff1742890aad6 Mon Sep 17 00:00:00 2001 From: Esteban Zimanyi Date: Fri, 9 Oct 2026 23:22:10 +0200 Subject: [PATCH] Pass a bound NULL to a parameter of any reference type on the typed SQL surfaces A parameter the catalog binds to NULL receives the Java literal null whatever its reference type, a jnr.ffi.Pointer or a java.lang.String alike, and is refused only for the eight primitive types, which hold no null. _bound_literal decides it for both typed SQL surfaces. Witness: over MobilityDB master a0480a7d38 and MEOS-API master f8f63bd the catalog binds srs of temporal_as_mfjson to NULL, as the PostgreSQL wrapper derives it from the value and MEOS names the reference system from spatial_ref_sys.csv when it is NULL; the jar types the parameter, a const char *, as java.lang.String, and main renders NULL only for jnr.ffi.Pointer, so both engines refuse the 20 asMFJSON signatures as bound:NULL/java.lang.String and register no asMFJSON. Measured over the same pair with the jar built from that catalog and that libmeos: no signature is refused for a bound NULL where main refuses 20, and the 121 refused for their argument count are unchanged; spark-sql and flink-sql each register 1155 SQL functions and 8829 overloads where main registers 1154 and 8754, the generated trees differing from main's only by AsMFJSON.java and its registration. The spark engine generates the same tree as main, and mvn clean install runs 106 codegen and 1800 jmeos-core tests green with no warning. Why: asMFJSON on Spark and Flink names the reference system as MEOS does for every binding, from its own reference systems. --- tools/codegen_jvm.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tools/codegen_jvm.py b/tools/codegen_jvm.py index 0b478ea63..c49beb9de 100644 --- a/tools/codegen_jvm.py +++ b/tools/codegen_jvm.py @@ -1059,7 +1059,10 @@ def _bound_literal(m, v, jt): if v in ('true', 'false'): return v if jt == 'boolean' else None if v == 'NULL': - return 'null' if jt == 'jnr.ffi.Pointer' else None + # Java takes null for every reference type, a pointer or a string alike, and for + # none of its eight primitive types + return None if jt in ('boolean', 'byte', 'char', 'short', 'int', 'long', 'float', + 'double') else 'null' try: x = float(v) except (TypeError, ValueError):