Skip to content

Commit

Permalink
more geospatial v2 integration tests (apache#11741)
Browse files Browse the repository at this point in the history
  • Loading branch information
xiangfu0 authored Oct 9, 2023
1 parent 52d16f7 commit 24af80d
Showing 1 changed file with 28 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,9 @@ public void testStPointFunctionWithV2(boolean useMultiStageQueryEngine)
+ "b.st_point, "
+ "b.st_point_1, "
+ "ST_DISTANCE(ST_Point(a.st_x, a.st_y, -1), b.st_point), "
+ "ST_DISTANCE(ST_Point(a.st_x, a.st_y, 1), b.st_point_1) "
+ "ST_DISTANCE(ST_Point(a.st_x, a.st_y, 1), b.st_point_1), "
+ "ST_DISTANCE(ST_Point(a.st_x, a.st_y, 0), ST_Point(40, -40, 0)), "
+ "ST_DISTANCE(ST_Point(a.st_x, a.st_y, 1), ST_Point(40, -40, 1)) "
+ "FROM %s a "
+ "JOIN %s b "
+ "ON a.wkt1=b.wkt1 "
Expand All @@ -328,6 +330,17 @@ public void testStPointFunctionWithV2(boolean useMultiStageQueryEngine)
BytesUtils.toBytes(record.get(3).asText()));
assertEquals(dist1, expectedDist1);
assertEquals(dist2, expectedDist2);

double dist3 = record.get(6).doubleValue();
double dist4 = record.get(7).doubleValue();
Point point = GeometryUtils.GEOMETRY_FACTORY.createPoint(new Coordinate(40, -40));
double expectedDist3 =
ScalarFunctions.stDistance(BytesUtils.toBytes(record.get(0).asText()), GeometrySerializer.serialize(point));
GeometryUtils.setGeography(point);
double expectedDist4 =
ScalarFunctions.stDistance(BytesUtils.toBytes(record.get(1).asText()), GeometrySerializer.serialize(point));
assertEquals(dist3, expectedDist3);
assertEquals(dist4, expectedDist4);
}
}
{
Expand All @@ -338,7 +351,9 @@ public void testStPointFunctionWithV2(boolean useMultiStageQueryEngine)
+ "b.st_point, "
+ "b.st_point_1, "
+ "ST_DISTANCE(ST_Point(a.st_x, a.st_y, false), b.st_point), "
+ "ST_DISTANCE(ST_Point(a.st_x, a.st_y, true), b.st_point_1) "
+ "ST_DISTANCE(ST_Point(a.st_x, a.st_y, true), b.st_point_1), "
+ "ST_DISTANCE(ST_Point(a.st_x, a.st_y, false), ST_Point(40, -40, false)), "
+ "ST_DISTANCE(ST_Point(a.st_x, a.st_y, true), ST_Point(40, -40, true)) "
+ "FROM %s a "
+ "JOIN %s b "
+ "ON a.wkt1=b.wkt1 "
Expand All @@ -357,6 +372,17 @@ public void testStPointFunctionWithV2(boolean useMultiStageQueryEngine)
BytesUtils.toBytes(record.get(3).asText()));
assertEquals(dist1, expectedDist1);
assertEquals(dist2, expectedDist2);

double dist3 = record.get(6).doubleValue();
double dist4 = record.get(7).doubleValue();
Point point = GeometryUtils.GEOMETRY_FACTORY.createPoint(new Coordinate(40, -40));
double expectedDist3 =
ScalarFunctions.stDistance(BytesUtils.toBytes(record.get(0).asText()), GeometrySerializer.serialize(point));
GeometryUtils.setGeography(point);
double expectedDist4 =
ScalarFunctions.stDistance(BytesUtils.toBytes(record.get(1).asText()), GeometrySerializer.serialize(point));
assertEquals(dist3, expectedDist3);
assertEquals(dist4, expectedDist4);
}
}
}
Expand Down

0 comments on commit 24af80d

Please sign in to comment.