• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

MobilityDB / MobilityDB / 21570397025
95%

Build:
DEFAULT BRANCH: master
Ran 01 Feb 2026 09:21PM UTC
Jobs 1
Files 128
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

01 Feb 2026 09:16PM UTC coverage: 95.249% (+0.004%) from 95.245%
21570397025

push

github

web-flow
Implement a 0(1) mapping from Oid -> meosType (#753)

This PR enables a 0(1) bidirectional mapping `meosType` → PostgreSQL
`Oid` and `Oid` → `meosType`.

There is already a 0(1) mapping from `meosType` -> `Oid` provided by the
function
```
Oid meostype_oid(meosType type)
```
which is implemented as an array of size `NO_MEOS_TYPES` (currently 63).
This array allows us to obtain the `Oid` corresponding to a `meosType`
by accessing an element of the array as follows
```
Oid result = MOBILITYDB_CONSTANTS->meostype_oid[type]
```

The mapping from `Oid` -> `meosType` provided by the function
```
meosType oid_meostype(Oid typid)
```
is now implemented as a hash table using the include file
`simplehash.h`. This hash table allows us to obtain the `meosType`
corresponding to an `Oid` by accessing using a hash-table lookup as
follows
```
oid_meostype_entry *entry = oid_meostype_lookup(
    MOBILITYDB_CONSTANTS->oid_meostype, typid);
  if (! entry)
    return T_UNKNOWN;
  else
    return entry->type;
```
instead of the previous solution which consists on the following loop
```
  for (int i = 0; i < NO_MEOS_TYPES; i++)
  {
    if (MOBILITYDB_CONSTANTS->meostype_oid[i] == typid)
      return i;
  }
```

The reason for this solution is that the look up of a `meosType` from an
`Oid` is needed at every single access of a value of a MEOS template
type, i.e., `set`, `span`, `spanset`, and `temporal` types, as in the
following example
```
Datum
Temporal_in(PG_FUNCTION_ARGS)
{
  const char *input = PG_GETARG_CSTRING(0);
  Oid temptypid = PG_GETARG_OID(1);
  Temporal *result = temporal_in(input, oid_meostype(temptypid));
  [...]
  PG_RETURN_TEMPORAL_P(result);
}
```
Therefore, the heavy usage of this function motivates using a hash
table.

An alternative solution is to have an Oid-indexed array with 2^32 =
65536 entries since the Oid type is defined as follows
```
typedef unsigned int Oid;
```
Although this solution is simpler algorithmically, only `NO_MEOS_TYPES`
out of t... (continued)

154 of 156 new or added lines in 31 files covered. (98.72%)

32517 of 34139 relevant lines covered (95.25%)

1112572.95 hits per line

New Missed Lines in Diff

Lines Coverage ∆ File
1
93.45
-0.3% mobilitydb/src/temporal/meos_catalog.c
1
86.26
0.0% mobilitydb/src/temporal/temporal_supportfn.c
Jobs
ID Job ID Ran Files Coverage
1 21570397025.1 01 Feb 2026 09:21PM UTC 128
95.25
GitHub Action Run
Source Files on build 21570397025
  • Tree
  • List 128
  • Changed 3
  • Source Changed 0
  • Coverage Changed 3
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • 68c194e2 on github
  • Prev Build on master (#21570381530)
  • Next Build on master (#21764000839)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc