Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions parser/header_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@
"uint64", "int8_t", "int16_t", "int32_t", "int64_t", "uint8_t",
"uint16_t", "uint32_t", "uint64_t", "TimestampTz", "TimeADT",
"DateADT", "Timestamp", "Datum", "meosType", "interpType",
# H3Index / Quadbin are uint64 cell ids: typerecover resolves them to
# uint64_t, so treat them as scalars here and leave that recovery intact
# rather than restoring the opaque spelling from the header source.
"H3Index", "Quadbin",
# H3Index / Quadbin / S2CellId are uint64 cell ids: typerecover resolves
# them to uint64_t, so treat them as scalars here and leave that recovery
# intact rather than restoring the opaque spelling from the header source.
"H3Index", "Quadbin", "S2CellId",
}


Expand Down
1 change: 1 addition & 0 deletions parser/typerecover.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
"TimestampTz": "TimestampTz",
"H3Index": "uint64_t",
"Quadbin": "uint64_t",
"S2CellId": "uint64_t",
"text": "text",
"GSERIALIZED": "GSERIALIZED",
"Interval": "Interval",
Expand Down
18 changes: 13 additions & 5 deletions tests/test_typerecover.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,15 +168,23 @@ def test_uint32_canonical_normalized(self):

def test_cell_id_canonical_normalized_uniform(self):
# H3Index (libh3's typedef, whose fully-resolved canonical is the platform
# "unsigned long") and Quadbin (MobilityDB's typedef, recovered to "uint64_t")
# are BOTH uint64 cell ids; as Tcell<T> subtypes they must be spelled identically.
# The ``canonical`` field must normalize to "uint64_t" for both, not leave H3Index
# at "unsigned long" — a guard on the _CANON_ALIAS canonical-normalization pass.
# "unsigned long"), Quadbin and S2CellId (MobilityDB's typedefs, recovered to
# "uint64_t") are ALL uint64 cell ids; as Tcell<T> subtypes they must be spelled
# identically. The ``canonical`` field must normalize to "uint64_t" for each, not
# leave one at "unsigned long" — a guard on the _CANON_ALIAS canonical-normalization
# pass.
for name in ("th3index_start_value", "th3index_end_value",
"tquadbin_start_value", "tquadbin_end_value", "h3index_in"):
"tquadbin_start_value", "tquadbin_end_value", "h3index_in",
"ts2cell_start_value", "ts2cell_end_value", "s2cell_in"):
rt = self.by_name[name]["returnType"]
self.assertEqual(rt["c"], "uint64_t", f"{name} c")
self.assertEqual(rt["canonical"], "uint64_t", f"{name} canonical")
# An array of cell ids is an array of by-value uint64_t, whichever cell
# typedef the header spells it with.
for name in ("th3index_values", "tquadbin_values", "ts2cell_values"):
rt = self.by_name[name]["returnType"]
self.assertEqual(rt["c"], "uint64_t *", f"{name} c")
self.assertEqual(rt["canonical"], "uint64_t *", f"{name} canonical")

def test_typedef_canonical_not_platform_resolved(self):
# ``canonical`` is the MEOS typedef its ``cType`` names, never libclang's
Expand Down
Loading