Fetch plan support in SQL select statements
fetch plan could be a new keyword of SQL SELECT syntax. In this way it could be used by JS scripts too.
Hi Luca, Fetch plan can be already specified as toJSON() parameter. Could not it be used in js functions?
I mean something like:
select from V fetchplan 'out:-1'
Fetch plan does not work any more for select statements after that change in async mode. Imo.. async listener got fetchplan after execution
((OCommandRequestInternal) connection.database.command(command)).execute();
// ASSIGNED THE PARSED FETCHPLAN
listener.setFetchPlan(((OCommandRequestInternal) connection.database.command(command)).getFetchPlan());
These two lines shouldn't be in oposite order? When I changed it everything got back to proper work. I think sync implementation still does not send prefetch payload, so fetch plan does not work.
Could you send me a pull request if pass all the test cases?
ant clean test mvn clean install
Luca, I have separate change for Prefetch in sync mode - binary portocol Problem is that, afaik, unlike async mode, PayloadStatus=0<NO MORE RECORDS/PAYLOADS> has never been sent after normal result ('l' or 'r') so far. After the change, it may break a compatibility for existing clients/drivers if they don't read full response (remaining PayloadStatus=0). How do you deal with such issues?
What do you mean for PayloadStatus=0 ?
Afaik, In sync mode, collection of records ('l') payload has been sent and that's all.
In async mode, It is a chain of payloads, Record (payload-status=1), Record, Record, Prefetched (payload-status=2),Prefetched and finally No more records (Payload status==0). In async I know that when I receive
Updated also binary protocol page: https://github.com/orientechnologies/orientdb/wiki/Network-Binary-Protocol#wiki-COMMAND
I will send separate pull request with change for sync statements.
Pawel said in the Google Group: I've just started to change my code according to your new implementation of prefetching in sync statements.
- Implemented prefetch payload is only one in whole protocol without payload-status, but async prefetch payload has payloadstatus (2).
- Each command has overhead of 4 bytes like ALTER,CREATE,CREATE INDEX and so on, even if they don't use/support prefetching
Please reconsider to implement it with payload status (probably a new one, because current prefetch has one record so it's rather prefetch collection) and add this payload only if prefetch documents are present and finally end response with payloadstatus=NoRecords(0). In such approach you will have only 1 byte overhead in ALTER/CREATE/INDEX
Good idea, let me do it...
Done
Works flawlessly in sync. Thanks!