opened
benjaminbillet
username_0
Hi,
The Blueprint API allows developers to write their own Predicate implementations. For example:
```java
GraphQuery query = graph.query();
query.has(someKey, new Predicate() {
	@Override
	public boolean evaluate(Object first, Object second) {
		...
	}
}, someValue);
```
However, this code throws an exception.
```
Exception in thread "main" com.orientechnologies.orient.core.sql.OCommandSQLParsingException: Error on parsing command at position #0: Encountered "" at line 1, column 21.
Was expecting one of:
    
	at com.orientechnologies.orient.core.sql.OCommandExecutorSQLAbstract.throwParsingException(OCommandExecutorSQLAbstract.java:101)
	at com.orientechnologies.orient.core.sql.OCommandExecutorSQLAbstract.preParse(OCommandExecutorSQLAbstract.java:237)
	at com.orientechnologies.orient.core.sql.OCommandExecutorSQLSelect.parse(OCommandExecutorSQLSelect.java:209)
	at com.orientechnologies.orient.core.sql.OCommandExecutorSQLSelect.parse(OCommandExecutorSQLSelect.java:89)
	at com.orientechnologies.orient.core.sql.OCommandExecutorSQLDelegate.parse(OCommandExecutorSQLDelegate.java:76)
	at com.orientechnologies.orient.core.sql.OCommandExecutorSQLDelegate.parse(OCommandExecutorSQLDelegate.java:42)
	at com.orientechnologies.orient.core.storage.impl.local.OAbstractPaginatedStorage.command(OAbstractPaginatedStorage.java:1211)
	at com.orientechnologies.orient.core.sql.query.OSQLQuery.run(OSQLQuery.java:72)
	at com.orientechnologies.orient.core.sql.query.OSQLSynchQuery.run(OSQLSynchQuery.java:85)
	at com.orientechnologies.orient.core.query.OQueryAbstract.execute(OQueryAbstract.java:33)
	at com.orientechnologies.orient.server.network.protocol.binary.ONetworkProtocolBinary.command(ONetworkProtocolBinary.java:1312)
	at com.orientechnologies.orient.server.network.protocol.binary.ONetworkProtocolBinary.executeRequest(ONetworkProtocolBinary.java:393)
	at com.orientechnologies.orient.server.network.protocol.binary.OBinaryNetworkProtocolAbstract.execute(OBinaryNetworkProtocolAbstract.java:222)
	at com.orientechnologies.common.thread.OSoftThread.run(OSoftThread.java:71)
```
I read the code of OrientGraphQuery and, apparently, this class simply builds an OrientDB SQL request by mapping the predefined predicates provided by the BlueprintAPI (`com.tinkerpop.blueprints.Compare and com.tinkerpop.blueprints.Compare` and `com.tinkerpop.blueprints.Contains`) to the OrientDB SQL keywords. This implementation implies that custom Predicate are de facto not supported by this class, while allowed by the Blueprint API.
Custom predicate in GraphQuery/VertexQuery
issue
created
lvca
username_1
Fixed, thanks.
comment
closed
lvca
username_1
issue
created
benjaminbillet
username_0
Wow, that was quick. Thanks.
comment
created
lvca
username_1
Unfortunately using custom predicate OrientDB can't optimize in SQL, so you could experiment slow down.
comment