Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NPE in geospatial query with subquery #9105

Closed
arch7tect opened this issue Jan 10, 2020 · 1 comment
Closed

NPE in geospatial query with subquery #9105

arch7tect opened this issue Jan 10, 2020 · 1 comment
Assignees
Labels
Milestone

Comments

@arch7tect
Copy link

OrientDB Version: 3.0.27

Java Version: jdk1.8.0_231

OS: windows 10

Expected behavior

Batch executes without errors

Actual behavior

NPE thrown

Steps to reproduce

drop class Country if exists unsafe;
create class Country extends V;
create property Country.name STRING;
create property Country.geometry EMBEDDED OMultiPolygon;
drop class POI if exists unsafe;
create class POI extends V;
create property POI.name STRING;
create property POI.location EMBEDDED OPoint;
insert into POI(name, location) values(“zeropoint”, St_GeomFromText(“Point(0 0)”));
insert into Country(name, geometry) values(“zeroland”, St_GeomFromText(“MultiPolygon(((1 1, 1 -1, -1 -1, -1 1, 1 1)))”));
CREATE INDEX POI.location ON POI(location) SPATIAL ENGINE LUCENE;
CREATE INDEX Country.geometry ON Country(geometry) SPATIAL ENGINE LUCENE;
let name = select name from Country where ST_Contains(geometry, (select location from POI)) = true;
return $name;

Throws exception:

java.lang.NullPointerException
at com.orientechnologies.orient.core.sql.executor.FetchFromIndexedFunctionStep.init(FetchFromIndexedFunctionStep.java:100)
at com.orientechnologies.orient.core.sql.executor.FetchFromIndexedFunctionStep.syncPull(FetchFromIndexedFunctionStep.java:38)
at com.orientechnologies.orient.core.sql.executor.FilterByClustersStep$1.fetchNextItem(FilterByClustersStep.java:57)
at com.orientechnologies.orient.core.sql.executor.FilterByClustersStep$1.hasNext(FilterByClustersStep.java:93)
at com.orientechnologies.orient.core.sql.executor.FilterByClassStep$1.fetchNextItem(FilterByClassStep.java:50)
at com.orientechnologies.orient.core.sql.executor.FilterByClassStep$1.hasNext(FilterByClassStep.java:88)
at com.orientechnologies.orient.core.sql.executor.ProjectionCalculationStep$1.hasNext(ProjectionCalculationStep.java:33)
at com.orientechnologies.orient.core.sql.parser.OLocalResultSet.fetchNext(OLocalResultSet.java:40)
at com.orientechnologies.orient.core.sql.parser.OLocalResultSet.(OLocalResultSet.java:30)
at com.orientechnologies.orient.core.sql.parser.OSelectStatement.execute(OSelectStatement.java:276)
at com.orientechnologies.orient.core.sql.parser.OStatement.execute(OStatement.java:79)
at com.orientechnologies.orient.core.db.document.ODatabaseDocumentEmbedded.command(ODatabaseDocumentEmbedded.java:567)
at com.orientechnologies.orient.server.network.protocol.http.command.post.OServerCommandPostCommand.executeStatement(OServerCommandPostCommand.java:189)
at com.orientechnologies.orient.server.network.protocol.http.command.post.OServerCommandPostCommand.execute(OServerCommandPostCommand.java:95)
at com.orientechnologies.orient.server.network.protocol.http.command.post.OServerCommandPostCommandGraph.execute(OServerCommandPostCommandGraph.java:36)
at com.orientechnologies.orient.server.network.protocol.http.ONetworkProtocolHttpAbstract.service(ONetworkProtocolHttpAbstract.java:228)
at com.orientechnologies.orient.server.network.protocol.http.ONetworkProtocolHttpAbstract.execute(ONetworkProtocolHttpAbstract.java:707)
at com.orientechnologies.common.thread.OSoftThread.run(OSoftThread.java:69)

Query
select name from Country where ST_Contains(geometry, “POINT(0 0)”) = true
executes without errors.

wolf4ood added a commit that referenced this issue Jan 10, 2020
@wolf4ood wolf4ood self-assigned this Jan 10, 2020
@wolf4ood wolf4ood added this to the 3.0.28 milestone Jan 10, 2020
@wolf4ood
Copy link
Member

Hi @arch7tect

i've just pushed a fix that cover this two cases

select name from Country LET $foo = (select * from POI) where ST_Contains(geometry, $foo[0].location) = true

and

select name from Country where ST_Contains(geometry, (select location from POI)) = true

For this one the limitation is that the result of the inner query should contain 1 record, since the geospatial functions does not support a collection in input.

It will be available in the next release 3.0.28 or in snapshot

Thanks

@wolf4ood wolf4ood added the bug label Jan 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants