From 5b04de9a61ec13b27d77febf175dc17a9110a408 Mon Sep 17 00:00:00 2001 From: Esteban Zimanyi Date: Tue, 23 Jun 2026 09:33:42 +0200 Subject: [PATCH] Recover the quadbin Quadbin collapsed C type MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Quadbin is a typedef of uint64 (meos_quadbin.h). Unlike H3Index — whose name is erased to int by the host-collision prefix rename, so the existing recovery (slot cType == int) catches it — Quadbin's name SURVIVES as the cType while only the canonical collapses to int (its underlying uint64 is the part that erased). So the recovery must also fire when the slot spells the typedef name, not just int. Add "Quadbin": "uint64_t" to the type-recovery map AND generalize the recovery to match either the collapsed `int` spelling or the surviving `original` typedef name, rewriting both cType and the collapsed canonical to uint64_t. Every catalog-driven binding now binds the quadbin cell as a 64-bit integer (bigint), like H3Index, instead of disagreeing on the collapsed int (JMEOS mapped the Quadbin cType to a Pointer; the Spark generator mapped the collapsed int to Integer). --- parser/typerecover.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/parser/typerecover.py b/parser/typerecover.py index 01d8153..b77e0e3 100644 --- a/parser/typerecover.py +++ b/parser/typerecover.py @@ -35,6 +35,7 @@ "Timestamp": "Timestamp", "TimestampTz": "TimestampTz", "H3Index": "uint64_t", + "Quadbin": "uint64_t", "text": "text", "GSERIALIZED": "GSERIALIZED", "Interval": "Interval", @@ -75,7 +76,8 @@ def _recovery(fragment): suffix = (" " + stars) if stars else "" collapsed = f"{const}int{suffix}" recovered = f"{const}{_TYPE_MAP[m.group('base')]}{suffix}" - return collapsed, recovered + original = f"{const}{m.group('base')}{suffix}" + return collapsed, recovered, original def _parse_header_decls(headers_dir): @@ -123,12 +125,17 @@ def _apply(slot, recovery): """Rewrite a return/param slot in place; return 1 if rewritten.""" if not (recovery and isinstance(slot, dict)): return 0 - collapsed, recovered = recovery + collapsed, recovered, original = recovery key = "c" if "c" in slot else "cType" - if _nospace(slot.get(key)) != _nospace(collapsed): + # The base name is either erased to int by the host-collision prefix + # rename (slot spells `collapsed`), or it survives while only the + # canonical collapses (slot spells `original`, e.g. a MobilityDB typedef + # such as Quadbin whose uint64 underlying type was the part that erased). + recoverable = (_nospace(collapsed), _nospace(original)) + if _nospace(slot.get(key)) not in recoverable: return 0 slot[key] = recovered - if _nospace(slot.get("canonical")) == _nospace(collapsed): + if _nospace(slot.get("canonical")) in recoverable: slot["canonical"] = recovered return 1