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
2 changes: 1 addition & 1 deletion benchmark/src/main/java/aisdata/Query1_Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ public void process(
// edwithin_tgeo_geo returns 1 if tpoint is within distanceMeters of the
// zone polygon at any instant — implements paper Line 2.
int within = GeneratedFunctions.edwithin_tgeo_geo(
tpoint, hazardZones[i], distanceMeters);
tpoint, hazardZones[i], distanceMeters, true);

if (within == 1) {
String alert = String.format(
Expand Down
2 changes: 1 addition & 1 deletion benchmark/src/main/java/aisdata/Query5_Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ public void process(

// Paper Line 2: edwithin_tgeo_geo(lon, lat, ts, POLYGON, 1) == 1
// Distance=1m is effectively an intersection test.
if (GeneratedFunctions.edwithin_tgeo_geo(tpoint, geofence, geofenceDistMeters) != 1) {
if (GeneratedFunctions.edwithin_tgeo_geo(tpoint, geofence, geofenceDistMeters, true) != 1) {
log.debug("MMSI={} skipped: outside geofence at ts={}", mmsi, ts);
continue;
}
Expand Down
2 changes: 1 addition & 1 deletion benchmark/src/main/java/aisdata/Query6_Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ public String join(AISData left, AISData right) throws Exception {
return null;
}

double mindist = GeneratedFunctions.geog_distance(geoLeft, geoRight);
double mindist = GeneratedFunctions.geog_distance(geoLeft, geoRight, true);

// Paper Line 5: filter(lat > 0.0): keep only pairs where left-side lat is positive.
// All AIS positions in this dataset are in the Northern Hemisphere (~55–58°N),
Expand Down
2 changes: 1 addition & 1 deletion benchmark/src/main/java/aisdata/Query7_Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ public void coGroup(
// Paper Line 2: device_id < device_id2
if (left.getMmsi() >= right.getMmsi()) continue;

double dist = GeneratedFunctions.geog_distance(geoLeft, geoRight);
double dist = GeneratedFunctions.geog_distance(geoLeft, geoRight, true);

// Keep only the minimum distance per unique (mmsi1, mmsi2) pair.
String key = left.getMmsi() + ":" + right.getMmsi();
Expand Down
2 changes: 1 addition & 1 deletion benchmark/src/main/java/aisdata/Query9_Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ public void coGroup(
// Paper Line 2: device_id != device_id2
if (left.getMmsi() == right.getMmsi()) continue;

double dist = GeneratedFunctions.geog_distance(geoLeft, geoRight);
double dist = GeneratedFunctions.geog_distance(geoLeft, geoRight, true);

// Key: directed pair "mmsi1→mmsi2"
String key = left.getMmsi() + "->" + right.getMmsi();
Expand Down
8 changes: 4 additions & 4 deletions benchmark/src/main/java/berlinmod/MEOSBridge.java
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public static boolean dwithinMetres(double lon1, double lat1,
double lon2, double lat2,
double radiusMetres) {
return GeneratedFunctions.edwithin_tgeo_geo(
tgeogInst(lon1, lat1), pointGeog(lon2, lat2), radiusMetres) == 1;
tgeogInst(lon1, lat1), pointGeog(lon2, lat2), radiusMetres, true) == 1;
}

/**
Expand All @@ -80,7 +80,7 @@ public static boolean dwithinSegmentMetres(double pLon, double pLat,
double radiusMetres) {
return GeneratedFunctions.edwithin_tgeo_geo(
tgeogInst(pLon, pLat),
lineGeog(s1Lon, s1Lat, s2Lon, s2Lat), radiusMetres) == 1;
lineGeog(s1Lon, s1Lat, s2Lon, s2Lat), radiusMetres, true) == 1;
}

/**
Expand All @@ -102,7 +102,7 @@ public static boolean intersectsBox(double lon, double lat,
*/
public static double distanceMetres(double lon1, double lat1,
double lon2, double lat2) {
return GeneratedFunctions.geog_distance(pointGeog(lon1, lat1), pointGeog(lon2, lat2));
return GeneratedFunctions.geog_distance(pointGeog(lon1, lat1), pointGeog(lon2, lat2), true);
}

/**
Expand All @@ -113,7 +113,7 @@ public static double distanceSegmentMetres(double pLon, double pLat,
double s1Lon, double s1Lat,
double s2Lon, double s2Lat) {
return GeneratedFunctions.geog_distance(
pointGeog(pLon, pLat), lineGeog(s1Lon, s1Lat, s2Lon, s2Lat));
pointGeog(pLon, pLat), lineGeog(s1Lon, s1Lat, s2Lon, s2Lat), true);
}

// ----------------------------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
* (left, right, ctx) -> {
* Pointer leftT = left.toTGeoPointer();
* Pointer rightT = right.toTGeoPointer();
* if (MeosOpsFreeGeo.edwithin_tgeo_tgeo(leftT, rightT, 100.0) != 0) {
* if (MeosOpsFreeGeo.edwithin_tgeo_tgeo(leftT, rightT, 100.0, true) != 0) {
* return new MeetingEvent(left.id(), right.id(), ctx.getLeftTimestamp());
* }
* return null; // no output for non-matches
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public static int[][] eDwithinPairs(Pointer[] a, Pointer[] b, double dist) {
Pointer arr1 = marshal(a, rt);
Pointer arr2 = marshal(b, rt);
Pointer countPtr = Memory.allocateDirect(rt, 4);
Pointer res = GeneratedFunctions.edwithin_tgeoarr_tgeoarr(arr1, a.length, arr2, b.length, dist, countPtr);
Pointer res = GeneratedFunctions.edwithin_tgeoarr_tgeoarr(arr1, a.length, arr2, b.length, dist, true, countPtr);
Reference.reachabilityFence(arr1);
Reference.reachabilityFence(arr2);
return readPairsAndFree(res, countPtr.getInt(0L));
Expand Down Expand Up @@ -68,7 +68,7 @@ public static TDwithin tDwithinPairs(Pointer[] a, Pointer[] b, double dist) {
Pointer arr2 = marshal(b, rt);
Pointer countPtr = Memory.allocateDirect(rt, 4);
Pointer periodsPtr = Memory.allocateDirect(rt, 8);
Pointer res = GeneratedFunctions.tdwithin_tgeoarr_tgeoarr(arr1, a.length, arr2, b.length, dist, countPtr, periodsPtr);
Pointer res = GeneratedFunctions.tdwithin_tgeoarr_tgeoarr(arr1, a.length, arr2, b.length, dist, true, countPtr, periodsPtr);
Reference.reachabilityFence(arr1);
Reference.reachabilityFence(arr2);
int cnt = countPtr.getInt(0L);
Expand Down
2 changes: 1 addition & 1 deletion benchmark/src/main/java/sncbdata/Query1_Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ public void process(Integer deviceId, Context context, Iterable<SNCBData> elemen
if (hazardZones[i] == null) continue;
// Paper Line 2: edwithin_tgeo_geo returns 1 if tpoint is within
// distanceMeters of the zone polygon at any instant.
if (GeneratedFunctions.edwithin_tgeo_geo(tpoint, hazardZones[i], distanceMeters) == 1) {
if (GeneratedFunctions.edwithin_tgeo_geo(tpoint, hazardZones[i], distanceMeters, true) == 1) {
String alert = String.format(
"[ALERT][Q1] DeviceID=%-6d | lon=%10.5f lat=%9.5f"
+ " | ts=%s | within %.0f m of ZONE %d | window [%s - %s]",
Expand Down
4 changes: 2 additions & 2 deletions benchmark/src/main/java/sncbdata/Query5_Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ public void process(Integer deviceId, Context context,
event.getLon(), event.getLat(), millisToTs(event.getTimestamp()));
Pointer tpoint = GeneratedFunctions.tgeogpoint_in(wkt);
if (tpoint == null) continue;
if (GeneratedFunctions.edwithin_tgeo_geo(tpoint, geofence, geofenceDistMeters) != 1) continue;
if (GeneratedFunctions.edwithin_tgeo_geo(tpoint, geofence, geofenceDistMeters, true) != 1) continue;
surviving.add(event);
}

Expand Down Expand Up @@ -289,7 +289,7 @@ public void process(Integer deviceId, Context context,
}

// Geofence filter: reuse the already-parsed instant pointer.
if (GeneratedFunctions.edwithin_tgeo_geo(inst, geofence, geofenceDistMeters) != 1) continue;
if (GeneratedFunctions.edwithin_tgeo_geo(inst, geofence, geofenceDistMeters, true) != 1) continue;

double speedMs = event.getGpsSpeed() * KMH_TO_MS;
speedSumMs += speedMs;
Expand Down
2 changes: 1 addition & 1 deletion benchmark/src/main/java/sncbdata/Query6_Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ public String join(SNCBData left, SNCBData right) throws Exception {
return null;
}

double mindist = GeneratedFunctions.geog_distance(geoLeft, geoRight);
double mindist = GeneratedFunctions.geog_distance(geoLeft, geoRight, true);

// Paper Line 5: lat > 0.0.
if (left.getLat() <= 0.0 || right.getLat() <= 0.0) return null;
Expand Down
2 changes: 1 addition & 1 deletion benchmark/src/main/java/sncbdata/Query7_Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ public void coGroup(Iterable<SNCBData> leftEvents, Iterable<SNCBData> rightEvent
// Paper Line 2: device_id < device_id2
if (left.getDeviceId() >= right.getDeviceId()) continue;

double dist = GeneratedFunctions.geog_distance(geoLeft, geoRight);
double dist = GeneratedFunctions.geog_distance(geoLeft, geoRight, true);
String key = left.getDeviceId() + ":" + right.getDeviceId();
if (!pairMap.containsKey(key) || dist < pairMap.get(key)[2]) {
pairMap.put(key, new double[]{
Expand Down
2 changes: 1 addition & 1 deletion benchmark/src/main/java/sncbdata/Query9_Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ public void coGroup(Iterable<SNCBData> leftEvents, Iterable<SNCBData> rightEvent
// Paper Line 2: device_id != device_id2
if (left.getDeviceId() == right.getDeviceId()) continue;

double dist = GeneratedFunctions.geog_distance(geoLeft, geoRight);
double dist = GeneratedFunctions.geog_distance(geoLeft, geoRight, true);
String key = left.getDeviceId() + "->" + right.getDeviceId();
if (!minDistMap.containsKey(key) || dist < minDistMap.get(key)[2]) {
minDistMap.put(key, new double[]{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ void eDwithinPairsMatchesScalarBaseline() {
Set<Long> baseline = new HashSet<>();
for (int i = 0; i < trips.length; i++)
for (int j = 0; j < trips.length; j++)
if (GeneratedFunctions.edwithin_tgeo_tgeo(trips[i], trips[j], MEET_DIST) == 1)
if (GeneratedFunctions.edwithin_tgeo_tgeo(trips[i], trips[j], MEET_DIST, true) == 1)
baseline.add(((long) i << 32) | j);
assertEquals(baseline, kernel, "set-set eDwithinPairs must equal the per-pair edwithin scalar");
// T0/T3 coincide and T1 crosses T0 — the join is non-empty.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
* (left, right, ctx) -> {
* Pointer leftT = left.toTGeoPointer();
* Pointer rightT = right.toTGeoPointer();
* if (MeosOpsFreeGeo.edwithin_tgeo_tgeo(leftT, rightT, 100.0) != 0) {
* if (MeosOpsFreeGeo.edwithin_tgeo_tgeo(leftT, rightT, 100.0, true) != 0) {
* return new MeetingEvent(left.id(), right.id(), ctx.getLeftTimestamp());
* }
* return null; // no output for non-matches
Expand Down
Loading