提交 a3278c46 authored 作者: Sven Schrader's avatar Sven Schrader

ignoring null spatial keys in MVSpatialIndex add/remove

上级 2a106bae
...@@ -126,6 +126,11 @@ public class MVSpatialIndex extends BaseIndex implements SpatialIndex, MVIndex { ...@@ -126,6 +126,11 @@ public class MVSpatialIndex extends BaseIndex implements SpatialIndex, MVIndex {
public void add(Session session, Row row) { public void add(Session session, Row row) {
TransactionMap<SpatialKey, Value> map = getMap(session); TransactionMap<SpatialKey, Value> map = getMap(session);
SpatialKey key = getKey(row); SpatialKey key = getKey(row);
if (key.isNull()) {
return;
}
if (indexType.isUnique()) { if (indexType.isUnique()) {
// this will detect committed entries only // this will detect committed entries only
RTreeCursor cursor = spatialMap.findContainedKeys(key); RTreeCursor cursor = spatialMap.findContainedKeys(key);
...@@ -166,6 +171,11 @@ public class MVSpatialIndex extends BaseIndex implements SpatialIndex, MVIndex { ...@@ -166,6 +171,11 @@ public class MVSpatialIndex extends BaseIndex implements SpatialIndex, MVIndex {
@Override @Override
public void remove(Session session, Row row) { public void remove(Session session, Row row) {
SpatialKey key = getKey(row); SpatialKey key = getKey(row);
if (key.isNull()) {
return;
}
TransactionMap<SpatialKey, Value> map = getMap(session); TransactionMap<SpatialKey, Value> map = getMap(session);
try { try {
Value old = map.remove(key); Value old = map.remove(key);
...@@ -213,7 +223,7 @@ public class MVSpatialIndex extends BaseIndex implements SpatialIndex, MVIndex { ...@@ -213,7 +223,7 @@ public class MVSpatialIndex extends BaseIndex implements SpatialIndex, MVIndex {
private SpatialKey getKey(SearchRow row) { private SpatialKey getKey(SearchRow row) {
Value v = row.getValue(columnIds[0]); Value v = row.getValue(columnIds[0]);
if (v == ValueNull.INSTANCE) { if (v == ValueNull.INSTANCE) {
return new SpatialKey(row.getKey(),0,0,0,0); return new SpatialKey(row.getKey());
} }
Geometry g = ((ValueGeometry) v.convertTo(Value.GEOMETRY)).getGeometryNoCopy(); Geometry g = ((ValueGeometry) v.convertTo(Value.GEOMETRY)).getGeometryNoCopy();
Envelope env = g.getEnvelopeInternal(); Envelope env = g.getEnvelopeInternal();
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论