That is strange. Could you create a ticket?

Best regards,
Artem Orobets

*Orient Technologies the Company behind OrientDB*


2014-04-25 4:31 GMT+03:00 Payne Chu <payne...@gmail.com>:

> Thanks Artem,
> I tried,
> SELECT expand(test())
> SELECT expand('test') FROM (SELECT test())
> traverse test from (SELECT test())
> But all return nothing.
>
>
> <https://lh5.googleusercontent.com/-Dn8YQhL7flo/U1m5Vx38_hI/AAAAAAAAAKg/qOorukKeqKM/s1600/Screen+Shot+2014-04-25+at+9.23.58+am.png><https://lh5.googleusercontent.com/-Dn8YQhL7flo/U1m5Vx38_hI/AAAAAAAAAKg/qOorukKeqKM/s1600/Screen+Shot+2014-04-25+at+9.23.58+am.png>
>
>
>
> On Friday, April 25, 2014 3:42:52 AM UTC+8, Artem Orobets wrote:
>
>> Try:
>> SELECT expand(test())
>>
>> It should return the same result.
>>
>> The issue there is that function return a collection of records, so when
>> query is executed it creates a wrapper document where insert this
>> collection. That's why you see "[1]" (collection with 1 element) instead of
>> the expected record.
>>
>> Best regards,
>> Artem Orobets
>>
>> * Orient Technologiesthe Company behind OrientDB*
>>
>>
>> 2014-04-24 4:57 GMT+03:00 Payne Chu <payn...@gmail.com>:
>>
>>>  I created a function below, and executed through Functions page,
>>> Browse page and Binary Protocol. they return differently.
>>> What I expect the return should always like Functions page. But Browse
>>> page and Binary Protocol only return Record Id.
>>> Any way can return Record from Function ?
>>> function test() {
>>>    return db.query("select from V where @rid=#9:1")
>>> }
>>>
>>>
>>>
>>> EXECUTED through Functions page
>>> [{"@type":"d","@rid":"#9:1","@version":25,"@class":"V","name":"HEY BO
>>> DIDDLEY","song_type":"cover","performances":5,"type":"song",
>>> "out_followed_by":["#11:0","#11:1","#11:2","#11:3","#11:4"],
>>> "out_written_by":"#9:7","out_sung_by":"#9:8","in_followed_by":["#11:10",
>>> "#11:150","#11:2578","#11:5574"],"@fieldTypes":"out_followed_by=
>>> g,in_followed_by=g"}]
>>>
>>>
>>>
>>> EXECUTED through Browse page
>>> SELECT test()
>>> returned
>>> {
>>>     "result": [
>>>         {
>>>             "@type": "d",
>>>             "@rid": "#-2:0",
>>>             "@version": 0,
>>>             "test": [
>>>                 1
>>>             ]
>>>         }
>>>     ],
>>>     "notification": "Query executed in 0.023 sec. Returned 1 record(s)"
>>> }
>>>
>>>
>>>
>>> EXECUTED through Binary Protocol
>>> p.Exec(SyncQuery(dbSid, "SELECT test()", -1, "", nil, nil, nil))
>>> server log
>>> 2014-04-24 09:47:02:355 INFO /127.0.0.1:49697 - Reading byte (1
>>> byte)... [OChannelBinaryServer]
>>> 2014-04-24 09:47:02:356 INFO /127.0.0.1:49697 - Read byte: 41
>>> [OChannelBinaryServer]
>>> 2014-04-24 09:47:02:356 INFO /127.0.0.1:49697 - Reading int (4
>>> bytes)... [OChannelBinaryServer]
>>> 2014-04-24 09:47:02:356 INFO /127.0.0.1:49697 - Read int: 5
>>> [OChannelBinaryServer]
>>> 2014-04-24 09:47:02:357 INFO /127.0.0.1:49697 - Reading byte (1
>>> byte)... [OChannelBinaryServer]
>>> 2014-04-24 09:47:02:357 INFO /127.0.0.1:49697 - Read byte: 115
>>> [OChannelBinaryServer]
>>> 2014-04-24 09:47:02:359 INFO /127.0.0.1:49697 - Reading chunk of bytes.
>>> Reading chunk length as int (4 bytes)... [OChannelBinaryServer]
>>> 2014-04-24 09:47:02:359 INFO /127.0.0.1:49697 - Read chunk lenght: 42
>>> [OChannelBinaryServer]
>>> 2014-04-24 09:47:02:359 INFO /127.0.0.1:49697 - Reading 42 bytes...
>>> [OChannelBinaryServer]
>>> SELECT test()�������� [OChannelBinaryServer]7 - Read 42 bytes: q
>>> 2014-04-24 09:47:02:413 INFO /127.0.0.1:49697 - Writing byte (1 byte):
>>> 0 [OChannelBinaryServer]
>>> 2014-04-24 09:47:02:414 INFO /127.0.0.1:49697 - Writing int (4 bytes):
>>> 5 [OChannelBinaryServer]
>>> 2014-04-24 09:47:02:414 INFO /127.0.0.1:49697 - Writing byte (1 byte):
>>> 108 [OChannelBinaryServer]
>>> 2014-04-24 09:47:02:414 INFO /127.0.0.1:49697 - Writing int (4 bytes):
>>> 1 [OChannelBinaryServer]
>>> 2014-04-24 09:47:02:416 INFO /127.0.0.1:49697 - Writing short (2
>>> bytes): 0 [OChannelBinaryServer]
>>> 2014-04-24 09:47:02:416 INFO /127.0.0.1:49697 - Writing byte (1 byte):
>>> 100 [OChannelBinaryServer]
>>> 2014-04-24 09:47:02:416 INFO /127.0.0.1:49697 - Writing short (2
>>> bytes): -2 [OChannelBinaryServer]
>>> 2014-04-24 09:47:02:416 INFO /127.0.0.1:49697 - Writing cluster
>>> position (8 bytes) : 0.... [OChannelBinaryServer]
>>> 2014-04-24 09:47:02:417 INFO /127.0.0.1:49697 - Writing int (4 bytes):
>>> 0 [OChannelBinaryServer]
>>> 2014-04-24 09:47:02:419 INFO /127.0.0.1:49697 - Writing bytes (4+11=15
>>> bytes): [116, 101, 115, 116, 58, 91, 35, 57, 58, 49, 93]
>>> [OChannelBinaryServer]
>>> 2014-04-24 09:47:02:419 INFO /127.0.0.1:49697 - Writing byte (1 byte):
>>> 0 [OChannelBinaryServer]
>>> deserialized record
>>> &Record{
>>>   Type:0x64,
>>>   Rid:RecordId{cluster:-2, position:0},
>>>   Version:0,
>>>   Content:{
>>>     "@type":100,
>>>     "test":[
>>>       {cluster:9, position:1}
>>>     ]
>>>   }
>>> }
>>>
>>>
>>>
>>>  --
>>>
>>> ---
>>> You received this message because you are subscribed to the Google
>>> Groups "OrientDB" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to orient-databa...@googlegroups.com.
>>>
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>  --
>
> ---
> You received this message because you are subscribed to the Google Groups
> "OrientDB" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to orient-database+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"OrientDB" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to orient-database+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to