orientechnologies / orientdb

OrientDB is the most versatile DBMS supporting Graph, Document, Reactive, Full-Text and Geospatial models in one Multi-Model product. OrientDB can run distributed (Multi-Master), supports SQL, ACID Transactions, Full-Text indexing and Reactive Queries.
https://orientdb.dev
Apache License 2.0
4.73k stars 869 forks source link

NullPointerException using an non existing index in SQL #8088

Closed sboucard closed 6 years ago

sboucard commented 6 years ago

OrientDB Version: 3.0.0.RC1

Java Version: _

OS: Windows 10

Using Studio, got a NullPointerException in my SELECT execution caused by the use of an index that does not exist (a typo in my case). The original error was obviously on my side, but I guess you would like to provide a better error message in such case.

The SQL looks like this one:

SELECT
FROM INDEX:ìndexthatdoesnotexist

The stacktrace is the following:

java.lang.NullPointerException
    at com.orientechnologies.orient.core.sql.executor.OSelectExecutionPlanner.calculateTargetClusters(OSelectExecutionPlanner.java:343)
    at com.orientechnologies.orient.core.sql.executor.OSelectExecutionPlanner.calculateShardingStrategy(OSelectExecutionPlanner.java:174)
    at com.orientechnologies.orient.core.sql.executor.OSelectExecutionPlanner.createExecutionPlan(OSelectExecutionPlanner.java:64)
    at com.orientechnologies.orient.core.sql.parser.OSelectStatement.createExecutionPlan(OSelectStatement.java:264)
    at com.orientechnologies.orient.core.sql.parser.OSelectStatement.execute(OSelectStatement.java:242)
    at com.orientechnologies.orient.core.sql.parser.OStatement.execute(OStatement.java:59)
    at com.orientechnologies.orient.core.db.document.ODatabaseDocumentEmbedded.command(ODatabaseDocumentEmbedded.java:545)
    at com.orientechnologies.orient.server.network.protocol.http.command.post.OServerCommandPostCommand.executeStatement(OServerCommandPostCommand.java:174)
    at com.orientechnologies.orient.server.network.protocol.http.command.post.OServerCommandPostCommand.execute(OServerCommandPostCommand.java:84)
    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:172)
    at com.orientechnologies.orient.server.network.protocol.http.ONetworkProtocolHttpAbstract.execute(ONetworkProtocolHttpAbstract.java:633)
    at com.orientechnologies.common.thread.OSoftThread.run(OSoftThread.java:82)
luigidellaquila commented 6 years ago

Hi @sboucard

I just pushed a fix for this, now the query executor returns a much more meaningful error

Thanks

Luigi