Skip to content
Merged
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
22 changes: 22 additions & 0 deletions src/test/java/org/mobilitydb/spark/GeneratedSqlSurfaceTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -465,4 +465,26 @@ void peakCountOverMergedPieces() {
+ "(SELECT k, tgeompointFromText(s) AS g FROM VALUES " + rows + " AS t(k, s)) "
+ "WHERE k = 1 GROUP BY k)"));
}

@Test
void aRasterDerivedByArithmeticIsReadAlongATrip() {
// A 3x3 32BF depth raster in SRID 4326 holding 10, 20, 30 / 40, 50, 60 / 70, 80, 90,
// as PostGIS's ST_AsHexWKB writes it.
String depth = "rasterFromHexWKB('0100000100000000000000F03F000000000000F0BF0000000000000000"
+ "000000000000084000000000000000000000000000000000E6100000030003000A000000000000204100"
+ "00A0410000F04100002042000048420000704200008C420000A0420000B442')";
String trip = "tgeompointFromText('SRID=4326;[POINT(0.5 2.5)@2001-01-01, "
+ "POINT(2.5 2.5)@2001-01-02, POINT(0.5 0.5)@2001-01-03]')";
// The clearance of a vessel of draught 8.5, as MobilityDB answers rasterValue(trip,
// depth - 8.5) in its raster regression test.
assertEquals("Interp=Step;[1.5@2001-01-01 00:00:00+00, 11.5@2001-01-01 06:00:00+00, "
+ "21.5@2001-01-01 18:00:00+00, 41.5@2001-01-02 06:00:00+00, "
+ "61.5@2001-01-02 18:00:00+00, 61.5@2001-01-03 00:00:00+00]",
scalar("SELECT asText(rasterValue(" + trip + ", rasterSub(" + depth + ", 8.5)))"));
String read = (String) scalar("SELECT asText(rasterValue(" + trip + ", " + depth + "))");
assertEquals(read, scalar("SELECT asText(rasterValue(" + trip + ", rasterDiv(rasterAdd("
+ depth + ", " + depth + "), 2.0)))"));
assertEquals(read, scalar("SELECT asText(rasterValue(" + trip + ", rasterDiv(rasterMul("
+ depth + ", " + depth + "), " + depth + ")))"));
}
}
Loading