OrientDB - fetchplan on OSQLSynchQuery command (binary)

38 views
Skip to first unread message

Hugo

unread,
Apr 26, 2015, 7:45:05 AM4/26/15
to orient-...@googlegroups.com
Hello,

I am having trouble with the fetchplan using the `REQUEST_COMMAND` with the `OSQLSynchQuery` command type.

I have the query method implemented (https://github.com/hugohiram/OrientDB-Extension/blob/master/orientdb/Query.zep), which works fine (or it seems to) but if I include the "fetch-plan" in the command payload it doesn't make a difference, I mean, I keep receiving the record without the fetched data.

This is the debug info from the OrientDB server (on the line 10, at the query, there is an encoded value between the class and the command, and another between the command and the fetchplan, but they don't appear in this message):

- Reading byte (1 byte)... [OChannelBinaryServer]
- Read byte: 41 [OChannelBinaryServer]
- Reading int (4 bytes)... [OChannelBinaryServer]
- Read int: 6 [OChannelBinaryServer]
- Reading byte (1 byte)... [OChannelBinaryServer]
- Read byte: 115 [OChannelBinaryServer]
- Reading chunk of bytes. Reading chunk length as int (4 bytes)... [OChannelBinaryServer]
- Read chunk lenght: 104 [OChannelBinaryServer]
- Reading 104 bytes... [OChannelBinaryServer]
- Read 104 bytes:
:com.orientechnologies.orient.core.sql.query.OSQLSynchQuery s select *
from admin role:-2 [OChannelBinaryServer]
- Writing byte (1 byte): 0 [OChannelBinaryServer]
- Writing int (4 bytes): 6 [OChannelBinaryServer]
- Writing byte (1 byte): 108 [OChannelBinaryServer]
- Writing int (4 bytes): 1 [OChannelBinaryServer]
- Writing short (2 bytes): 0 [OChannelBinaryServer]
- Writing byte (1 byte): 100 [OChannelBinaryServer]
- Writing short (2 bytes): 17 [OChannelBinaryServer]
- Writing long (8 bytes): 0 [OChannelBinaryServer]
- Writing int (4 bytes): 16 [OChannelBinaryServer]
- Writing bytes (4+261=265 bytes): [97, 100, 109, ... 48] [OChannelBinaryServer]
- Writing byte (1 byte): 0 [OChannelBinaryServer]
- Flush [OChannelBinaryServer]

According to the documentation (http://orientdb.com/docs/last/Network-Binary-Protocol.html#request_command), the request is as follows:

`(mode:byte)(command-payload-length:int)(class-name:string)(command-payload)`

This is what I do:

* Set the mode (s)
* Calculate the length of the classname and the command payload (classname + query + limit + fetchplan + 0)
* Set the command-payload-length
* Set the command-payload (classname + command-payload)

This last step is what is confusing, because I am setting the classname and the payload at the same time, and the basic search is working (with the exception that brings me here), is this the typical two wrongs make one good?

I have tried the exact way as in the docs, but I always get a `java.lang.OutOfMemoryError`. So, the specific question is: what is correct way to do this? and, is the payload being generated correctly?

In the same docs, the supported types specifies that the strings must include the length of the content as int, but I am worried that I am including it even in the calculations where it is not needed...

You can see the whole code in the library from the first link.

Regards,
Hugo.
Reply all
Reply to author
Forward
0 new messages