提交 8a64de4e authored 作者: Sven Schrader's avatar Sven Schrader

spatial key fix for null geometries

上级 764d67bb
......@@ -244,7 +244,10 @@ public class SpatialDataType implements DataType {
SpatialKey a = (SpatialKey) objA;
SpatialKey b = (SpatialKey) objB;
if (a.isNull() || b.isNull()) {
return false;
// In order for null geometries to be found,
// a simple contains-relation is mimicked on the Ids
// instead of the empty boundinx boxes.
return a.getId() <= b.getId();
}
for (int i = 0; i < dimensions; i++) {
if (a.min(i) > b.min(i) || a.max(i) < b.max(i)) {
......
......@@ -1009,9 +1009,9 @@ public class TestSpatial extends TestBase {
stat.execute("create memory table test"
+ "(id int primary key, the_geom geometry, description varchar2(32))");
stat.execute("create spatial index on test(the_geom)");
stat.execute("insert into test values(1, null, null)");
stat.execute("insert into test values(2, null, null)");
stat.execute("insert into test values(3, null, null)");
for (int i = 0; i < 1000; i++) {
stat.execute("insert into test values("+ (i + 1) +", null, null)");
}
ResultSet rs = stat.executeQuery("select * from test");
assertTrue(rs.next());
assertEquals(1, rs.getInt(1));
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论