You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@vxquery.apache.org by Riyafa Abdul Hameed <ri...@cse.mrt.ac.lk> on 2016/08/05 14:42:23 UTC

Issue in JSONiq Object key listing and Array unboxing

Hi,

When looking for a good example for the documentation, I came across the
following issue in Object key listing and Array unboxing:

The code

let $x := {
“name” : {“id” : 123, “first” : “Riyafa”, “Last” : “Abdul
Hameed”}}return $x(“name”)()

returns

 {“id” : 123, “first” : “Riyafa”, “Last” : “Abdul Hameed”}

but the code,

let $x := {
“name” : {“id” : 123, “first” : “Riyafa”, “Last” : “Abdul Hameed”}}
let $y := $x(“name”)return $y()

returns

id
first
Last

But, as I understand both code should return:

id
first
Last

The same issue is present in Array unboxing:
For example the code

let $x := [[ “mercury”, “venus”, “earth”, “mars” ],[ “monday”,
“tuesday”, “wednesday”, “thursday” ]]return $x(1)()

returns

[ “mercury”, “venus”, “earth”, “mars” ]


while the code

let $x := [[ “mercury”, “venus”, “earth”, “mars” ],[ “monday”,
“tuesday”, “wednesday”, “thursday” ]]
let $y := $x(1)return $y()

returns

mercury
venus
earth
mars

Here also I think both should return:

mercury
venus
earth
mars

I would like to know whether this is a language feature or if its an
implementation issue. If it’s an implementation issue I am not sure I
understand where the issue is. Any suggestions would be highly appreciated.
​
-- 
Riyafa Abdul Hameed
Undergraduate, University of Moratuwa

Email: riyafa.12@cse.mrt.ac.lk
Website: https://riyafa.wordpress.com/ <http://riyafa.wordpress.com/>
<http://facebook.com/riyafa.ahf>  <http://lk.linkedin.com/in/riyafa>
<http://twitter.com/Riyafa1>

Re: Issue in JSONiq Object key listing and Array unboxing

Posted by Riyafa Abdul Hameed <ri...@cse.mrt.ac.lk>.
Hi,

I have updated the PR[1] based on the suggestion.

[1] https://github.com/apache/vxquery/pull/143

Thank you.

Yours sincerely,
Riyafa

On 8 August 2016 at 06:40, Till Westmann <ti...@apache.org> wrote:

> Hi Riyafa,
>
> sorry for coming late to the discussion.
> Could you change the message of the commit to contain the issue number?
> Then the JIRA issue will automatically be updated with a link to the
> commit.
> The message could be e.g. (also keeping to the 50 char limit for the
> subject
> line):
>
> VXQUERY-226: fix key listing and array unboxing
>
> Cheers,
> Till
>
>
> On 7 Aug 2016, at 17:58, Riyafa Abdul Hameed wrote:
>
> Hi,
>>
>> I have squashed the commits for merging[1] and have created an issue in
>> the
>> jira[2].
>>
>> [1] https://github.com/apache/vxquery/pull/143
>> [2] https://issues.apache.org/jira/browse/VXQUERY-226
>>
>> Thank you.
>>
>> Yours sincerely,
>> Riyafa
>>
>> On 5 August 2016 at 22:53, Riyafa Abdul Hameed <ri...@cse.mrt.ac.lk>
>> wrote:
>>
>> Hi,
>>>
>>> The issue was in the XMLQueryTranslator. I have fixed the issue with the
>>> relevant tests[1].
>>>
>>> [1] https://github.com/apache/vxquery/pull/138
>>>
>>> Thank you.
>>>
>>> Yours sincerely,
>>> Riyafa
>>>
>>> On 5 August 2016 at 21:01, Till Westmann <ti...@apache.org> wrote:
>>>
>>> Hi Riyafa,
>>>>
>>>> I agree with your expected results and at first glance it looks like an
>>>> implementation issue to me.
>>>> It seems that the direct application of the object key listing on an
>>>> object
>>>> results in a different plan than doing the same operation through a
>>>> let-variable.
>>>> To find the issue I would try to look at the different optimized plans
>>>> for
>>>> both queries and see what the difference between the plans is. It almost
>>>> looks like the object key listing is not executed and so it might be
>>>> that
>>>> it
>>>> is not part of the plan (even though that seems highly unlikely).
>>>> If it is part of the plan, it would be interesting to find out what
>>>> exactly
>>>> the data model instance looks like that is passed from the key access to
>>>> the
>>>> object key listing. Using fn:trace to do that might be a good first
>>>> step.
>>>>
>>>> Does this help?
>>>>
>>>> Cheers,
>>>> Till
>>>>
>>>> On 5 Aug 2016, at 7:42, Riyafa Abdul Hameed wrote:
>>>>
>>>> Hi,
>>>>
>>>>>
>>>>> When looking for a good example for the documentation, I came across
>>>>> the
>>>>> following issue in Object key listing and Array unboxing:
>>>>>
>>>>> The code
>>>>>
>>>>> let $x := {
>>>>> “name” : {“id” : 123, “first” : “Riyafa”, “Last” : “Abdul
>>>>> Hameed”}}return $x(“name”)()
>>>>>
>>>>> returns
>>>>>
>>>>>  {“id” : 123, “first” : “Riyafa”, “Last” : “Abdul Hameed”}
>>>>>
>>>>> but the code,
>>>>>
>>>>> let $x := {
>>>>> “name” : {“id” : 123, “first” : “Riyafa”, “Last” : “Abdul Hameed”}}
>>>>> let $y := $x(“name”)return $y()
>>>>>
>>>>> returns
>>>>>
>>>>> id
>>>>> first
>>>>> Last
>>>>>
>>>>> But, as I understand both code should return:
>>>>>
>>>>> id
>>>>> first
>>>>> Last
>>>>>
>>>>> The same issue is present in Array unboxing:
>>>>> For example the code
>>>>>
>>>>> let $x := [[ “mercury”, “venus”, “earth”, “mars” ],[ “monday”,
>>>>> “tuesday”, “wednesday”, “thursday” ]]return $x(1)()
>>>>>
>>>>> returns
>>>>>
>>>>> [ “mercury”, “venus”, “earth”, “mars” ]
>>>>>
>>>>>
>>>>> while the code
>>>>>
>>>>> let $x := [[ “mercury”, “venus”, “earth”, “mars” ],[ “monday”,
>>>>> “tuesday”, “wednesday”, “thursday” ]]
>>>>> let $y := $x(1)return $y()
>>>>>
>>>>> returns
>>>>>
>>>>> mercury
>>>>> venus
>>>>> earth
>>>>> mars
>>>>>
>>>>> Here also I think both should return:
>>>>>
>>>>> mercury
>>>>> venus
>>>>> earth
>>>>> mars
>>>>>
>>>>> I would like to know whether this is a language feature or if its an
>>>>> implementation issue. If it’s an implementation issue I am not sure I
>>>>> understand where the issue is. Any suggestions would be highly
>>>>> appreciated.
>>>>> ​
>>>>> --
>>>>> Riyafa Abdul Hameed
>>>>> Undergraduate, University of Moratuwa
>>>>>
>>>>> Email: riyafa.12@cse.mrt.ac.lk
>>>>> Website: https://riyafa.wordpress.com/ <http://riyafa.wordpress.com/>
>>>>> <http://facebook.com/riyafa.ahf>  <http://lk.linkedin.com/in/riyafa>
>>>>> <http://twitter.com/Riyafa1>
>>>>>
>>>>>
>>>>
>>>
>>> --
>>> Riyafa Abdul Hameed
>>> Undergraduate, University of Moratuwa
>>>
>>> Email: riyafa.12@cse.mrt.ac.lk
>>> Website: https://riyafa.wordpress.com/ <http://riyafa.wordpress.com/>
>>> <http://facebook.com/riyafa.ahf>  <http://lk.linkedin.com/in/riyafa>
>>> <http://twitter.com/Riyafa1>
>>>
>>>
>>
>>
>> --
>> Riyafa Abdul Hameed
>> Undergraduate, University of Moratuwa
>>
>> Email: riyafa.12@cse.mrt.ac.lk
>> Website: https://riyafa.wordpress.com/ <http://riyafa.wordpress.com/>
>> <http://facebook.com/riyafa.ahf>  <http://lk.linkedin.com/in/riyafa>
>> <http://twitter.com/Riyafa1>
>>
>


-- 
Riyafa Abdul Hameed
Undergraduate, University of Moratuwa

Email: riyafa.12@cse.mrt.ac.lk
Website: https://riyafa.wordpress.com/ <http://riyafa.wordpress.com/>
<http://facebook.com/riyafa.ahf>  <http://lk.linkedin.com/in/riyafa>
<http://twitter.com/Riyafa1>

Re: Issue in JSONiq Object key listing and Array unboxing

Posted by Till Westmann <ti...@apache.org>.
Hi Riyafa,

sorry for coming late to the discussion.
Could you change the message of the commit to contain the issue number?
Then the JIRA issue will automatically be updated with a link to the 
commit.
The message could be e.g. (also keeping to the 50 char limit for the 
subject
line):

VXQUERY-226: fix key listing and array unboxing

Cheers,
Till

On 7 Aug 2016, at 17:58, Riyafa Abdul Hameed wrote:

> Hi,
>
> I have squashed the commits for merging[1] and have created an issue 
> in the
> jira[2].
>
> [1] https://github.com/apache/vxquery/pull/143
> [2] https://issues.apache.org/jira/browse/VXQUERY-226
>
> Thank you.
>
> Yours sincerely,
> Riyafa
>
> On 5 August 2016 at 22:53, Riyafa Abdul Hameed 
> <ri...@cse.mrt.ac.lk>
> wrote:
>
>> Hi,
>>
>> The issue was in the XMLQueryTranslator. I have fixed the issue with 
>> the
>> relevant tests[1].
>>
>> [1] https://github.com/apache/vxquery/pull/138
>>
>> Thank you.
>>
>> Yours sincerely,
>> Riyafa
>>
>> On 5 August 2016 at 21:01, Till Westmann <ti...@apache.org> wrote:
>>
>>> Hi Riyafa,
>>>
>>> I agree with your expected results and at first glance it looks like 
>>> an
>>> implementation issue to me.
>>> It seems that the direct application of the object key listing on an
>>> object
>>> results in a different plan than doing the same operation through a
>>> let-variable.
>>> To find the issue I would try to look at the different optimized 
>>> plans for
>>> both queries and see what the difference between the plans is. It 
>>> almost
>>> looks like the object key listing is not executed and so it might be 
>>> that
>>> it
>>> is not part of the plan (even though that seems highly unlikely).
>>> If it is part of the plan, it would be interesting to find out what
>>> exactly
>>> the data model instance looks like that is passed from the key 
>>> access to
>>> the
>>> object key listing. Using fn:trace to do that might be a good first 
>>> step.
>>>
>>> Does this help?
>>>
>>> Cheers,
>>> Till
>>>
>>> On 5 Aug 2016, at 7:42, Riyafa Abdul Hameed wrote:
>>>
>>> Hi,
>>>>
>>>> When looking for a good example for the documentation, I came 
>>>> across the
>>>> following issue in Object key listing and Array unboxing:
>>>>
>>>> The code
>>>>
>>>> let $x := {
>>>> \u201cname\u201d : {\u201cid\u201d : 123, \u201cfirst\u201d : \u201cRiyafa\u201d, 
>>>> \u201cLast\u201d : \u201cAbdul
>>>> Hameed\u201d}}return $x(\u201cname\u201d)()
>>>>
>>>> returns
>>>>
>>>>  {\u201cid\u201d : 123, \u201cfirst\u201d : \u201cRiyafa\u201d, \u201cLast\u201d : \u201cAbdul 
>>>> Hameed\u201d}
>>>>
>>>> but the code,
>>>>
>>>> let $x := {
>>>> \u201cname\u201d : {\u201cid\u201d : 123, \u201cfirst\u201d : \u201cRiyafa\u201d, 
>>>> \u201cLast\u201d : \u201cAbdul Hameed\u201d}}
>>>> let $y := $x(\u201cname\u201d)return $y()
>>>>
>>>> returns
>>>>
>>>> id
>>>> first
>>>> Last
>>>>
>>>> But, as I understand both code should return:
>>>>
>>>> id
>>>> first
>>>> Last
>>>>
>>>> The same issue is present in Array unboxing:
>>>> For example the code
>>>>
>>>> let $x := [[ \u201cmercury\u201d, \u201cvenus\u201d, \u201cearth\u201d, \u201cmars\u201d 
>>>> ],[ \u201cmonday\u201d,
>>>> \u201ctuesday\u201d, \u201cwednesday\u201d, \u201cthursday\u201d ]]return $x(1)()
>>>>
>>>> returns
>>>>
>>>> [ \u201cmercury\u201d, \u201cvenus\u201d, \u201cearth\u201d, \u201cmars\u201d ]
>>>>
>>>>
>>>> while the code
>>>>
>>>> let $x := [[ \u201cmercury\u201d, \u201cvenus\u201d, \u201cearth\u201d, \u201cmars\u201d 
>>>> ],[ \u201cmonday\u201d,
>>>> \u201ctuesday\u201d, \u201cwednesday\u201d, \u201cthursday\u201d ]]
>>>> let $y := $x(1)return $y()
>>>>
>>>> returns
>>>>
>>>> mercury
>>>> venus
>>>> earth
>>>> mars
>>>>
>>>> Here also I think both should return:
>>>>
>>>> mercury
>>>> venus
>>>> earth
>>>> mars
>>>>
>>>> I would like to know whether this is a language feature or if its 
>>>> an
>>>> implementation issue. If it\u2019s an implementation issue I am not 
>>>> sure I
>>>> understand where the issue is. Any suggestions would be highly
>>>> appreciated.
>>>> \u200b
>>>> --
>>>> Riyafa Abdul Hameed
>>>> Undergraduate, University of Moratuwa
>>>>
>>>> Email: riyafa.12@cse.mrt.ac.lk
>>>> Website: https://riyafa.wordpress.com/ 
>>>> <http://riyafa.wordpress.com/>
>>>> <http://facebook.com/riyafa.ahf>  
>>>> <http://lk.linkedin.com/in/riyafa>
>>>> <http://twitter.com/Riyafa1>
>>>>
>>>
>>
>>
>> --
>> Riyafa Abdul Hameed
>> Undergraduate, University of Moratuwa
>>
>> Email: riyafa.12@cse.mrt.ac.lk
>> Website: https://riyafa.wordpress.com/ <http://riyafa.wordpress.com/>
>> <http://facebook.com/riyafa.ahf>  <http://lk.linkedin.com/in/riyafa>
>> <http://twitter.com/Riyafa1>
>>
>
>
>
> -- 
> Riyafa Abdul Hameed
> Undergraduate, University of Moratuwa
>
> Email: riyafa.12@cse.mrt.ac.lk
> Website: https://riyafa.wordpress.com/ <http://riyafa.wordpress.com/>
> <http://facebook.com/riyafa.ahf>  <http://lk.linkedin.com/in/riyafa>
> <http://twitter.com/Riyafa1>

Re: Issue in JSONiq Object key listing and Array unboxing

Posted by Riyafa Abdul Hameed <ri...@cse.mrt.ac.lk>.
Hi,

I have squashed the commits for merging[1] and have created an issue in the
jira[2].

[1] https://github.com/apache/vxquery/pull/143
[2] https://issues.apache.org/jira/browse/VXQUERY-226

Thank you.

Yours sincerely,
Riyafa

On 5 August 2016 at 22:53, Riyafa Abdul Hameed <ri...@cse.mrt.ac.lk>
wrote:

> Hi,
>
> The issue was in the XMLQueryTranslator. I have fixed the issue with the
> relevant tests[1].
>
> [1] https://github.com/apache/vxquery/pull/138
>
> Thank you.
>
> Yours sincerely,
> Riyafa
>
> On 5 August 2016 at 21:01, Till Westmann <ti...@apache.org> wrote:
>
>> Hi Riyafa,
>>
>> I agree with your expected results and at first glance it looks like an
>> implementation issue to me.
>> It seems that the direct application of the object key listing on an
>> object
>> results in a different plan than doing the same operation through a
>> let-variable.
>> To find the issue I would try to look at the different optimized plans for
>> both queries and see what the difference between the plans is. It almost
>> looks like the object key listing is not executed and so it might be that
>> it
>> is not part of the plan (even though that seems highly unlikely).
>> If it is part of the plan, it would be interesting to find out what
>> exactly
>> the data model instance looks like that is passed from the key access to
>> the
>> object key listing. Using fn:trace to do that might be a good first step.
>>
>> Does this help?
>>
>> Cheers,
>> Till
>>
>> On 5 Aug 2016, at 7:42, Riyafa Abdul Hameed wrote:
>>
>> Hi,
>>>
>>> When looking for a good example for the documentation, I came across the
>>> following issue in Object key listing and Array unboxing:
>>>
>>> The code
>>>
>>> let $x := {
>>> “name” : {“id” : 123, “first” : “Riyafa”, “Last” : “Abdul
>>> Hameed”}}return $x(“name”)()
>>>
>>> returns
>>>
>>>  {“id” : 123, “first” : “Riyafa”, “Last” : “Abdul Hameed”}
>>>
>>> but the code,
>>>
>>> let $x := {
>>> “name” : {“id” : 123, “first” : “Riyafa”, “Last” : “Abdul Hameed”}}
>>> let $y := $x(“name”)return $y()
>>>
>>> returns
>>>
>>> id
>>> first
>>> Last
>>>
>>> But, as I understand both code should return:
>>>
>>> id
>>> first
>>> Last
>>>
>>> The same issue is present in Array unboxing:
>>> For example the code
>>>
>>> let $x := [[ “mercury”, “venus”, “earth”, “mars” ],[ “monday”,
>>> “tuesday”, “wednesday”, “thursday” ]]return $x(1)()
>>>
>>> returns
>>>
>>> [ “mercury”, “venus”, “earth”, “mars” ]
>>>
>>>
>>> while the code
>>>
>>> let $x := [[ “mercury”, “venus”, “earth”, “mars” ],[ “monday”,
>>> “tuesday”, “wednesday”, “thursday” ]]
>>> let $y := $x(1)return $y()
>>>
>>> returns
>>>
>>> mercury
>>> venus
>>> earth
>>> mars
>>>
>>> Here also I think both should return:
>>>
>>> mercury
>>> venus
>>> earth
>>> mars
>>>
>>> I would like to know whether this is a language feature or if its an
>>> implementation issue. If it’s an implementation issue I am not sure I
>>> understand where the issue is. Any suggestions would be highly
>>> appreciated.
>>> ​
>>> --
>>> Riyafa Abdul Hameed
>>> Undergraduate, University of Moratuwa
>>>
>>> Email: riyafa.12@cse.mrt.ac.lk
>>> Website: https://riyafa.wordpress.com/ <http://riyafa.wordpress.com/>
>>> <http://facebook.com/riyafa.ahf>  <http://lk.linkedin.com/in/riyafa>
>>> <http://twitter.com/Riyafa1>
>>>
>>
>
>
> --
> Riyafa Abdul Hameed
> Undergraduate, University of Moratuwa
>
> Email: riyafa.12@cse.mrt.ac.lk
> Website: https://riyafa.wordpress.com/ <http://riyafa.wordpress.com/>
> <http://facebook.com/riyafa.ahf>  <http://lk.linkedin.com/in/riyafa>
> <http://twitter.com/Riyafa1>
>



-- 
Riyafa Abdul Hameed
Undergraduate, University of Moratuwa

Email: riyafa.12@cse.mrt.ac.lk
Website: https://riyafa.wordpress.com/ <http://riyafa.wordpress.com/>
<http://facebook.com/riyafa.ahf>  <http://lk.linkedin.com/in/riyafa>
<http://twitter.com/Riyafa1>

Re: Issue in JSONiq Object key listing and Array unboxing

Posted by Riyafa Abdul Hameed <ri...@cse.mrt.ac.lk>.
Hi,

The issue was in the XMLQueryTranslator. I have fixed the issue with the
relevant tests[1].

[1] https://github.com/apache/vxquery/pull/138

Thank you.

Yours sincerely,
Riyafa

On 5 August 2016 at 21:01, Till Westmann <ti...@apache.org> wrote:

> Hi Riyafa,
>
> I agree with your expected results and at first glance it looks like an
> implementation issue to me.
> It seems that the direct application of the object key listing on an object
> results in a different plan than doing the same operation through a
> let-variable.
> To find the issue I would try to look at the different optimized plans for
> both queries and see what the difference between the plans is. It almost
> looks like the object key listing is not executed and so it might be that
> it
> is not part of the plan (even though that seems highly unlikely).
> If it is part of the plan, it would be interesting to find out what exactly
> the data model instance looks like that is passed from the key access to
> the
> object key listing. Using fn:trace to do that might be a good first step.
>
> Does this help?
>
> Cheers,
> Till
>
> On 5 Aug 2016, at 7:42, Riyafa Abdul Hameed wrote:
>
> Hi,
>>
>> When looking for a good example for the documentation, I came across the
>> following issue in Object key listing and Array unboxing:
>>
>> The code
>>
>> let $x := {
>> “name” : {“id” : 123, “first” : “Riyafa”, “Last” : “Abdul
>> Hameed”}}return $x(“name”)()
>>
>> returns
>>
>>  {“id” : 123, “first” : “Riyafa”, “Last” : “Abdul Hameed”}
>>
>> but the code,
>>
>> let $x := {
>> “name” : {“id” : 123, “first” : “Riyafa”, “Last” : “Abdul Hameed”}}
>> let $y := $x(“name”)return $y()
>>
>> returns
>>
>> id
>> first
>> Last
>>
>> But, as I understand both code should return:
>>
>> id
>> first
>> Last
>>
>> The same issue is present in Array unboxing:
>> For example the code
>>
>> let $x := [[ “mercury”, “venus”, “earth”, “mars” ],[ “monday”,
>> “tuesday”, “wednesday”, “thursday” ]]return $x(1)()
>>
>> returns
>>
>> [ “mercury”, “venus”, “earth”, “mars” ]
>>
>>
>> while the code
>>
>> let $x := [[ “mercury”, “venus”, “earth”, “mars” ],[ “monday”,
>> “tuesday”, “wednesday”, “thursday” ]]
>> let $y := $x(1)return $y()
>>
>> returns
>>
>> mercury
>> venus
>> earth
>> mars
>>
>> Here also I think both should return:
>>
>> mercury
>> venus
>> earth
>> mars
>>
>> I would like to know whether this is a language feature or if its an
>> implementation issue. If it’s an implementation issue I am not sure I
>> understand where the issue is. Any suggestions would be highly
>> appreciated.
>> ​
>> --
>> Riyafa Abdul Hameed
>> Undergraduate, University of Moratuwa
>>
>> Email: riyafa.12@cse.mrt.ac.lk
>> Website: https://riyafa.wordpress.com/ <http://riyafa.wordpress.com/>
>> <http://facebook.com/riyafa.ahf>  <http://lk.linkedin.com/in/riyafa>
>> <http://twitter.com/Riyafa1>
>>
>


-- 
Riyafa Abdul Hameed
Undergraduate, University of Moratuwa

Email: riyafa.12@cse.mrt.ac.lk
Website: https://riyafa.wordpress.com/ <http://riyafa.wordpress.com/>
<http://facebook.com/riyafa.ahf>  <http://lk.linkedin.com/in/riyafa>
<http://twitter.com/Riyafa1>

Re: Issue in JSONiq Object key listing and Array unboxing

Posted by Till Westmann <ti...@apache.org>.
Hi Riyafa,

I agree with your expected results and at first glance it looks like an
implementation issue to me.
It seems that the direct application of the object key listing on an 
object
results in a different plan than doing the same operation through a
let-variable.
To find the issue I would try to look at the different optimized plans 
for
both queries and see what the difference between the plans is. It almost
looks like the object key listing is not executed and so it might be 
that it
is not part of the plan (even though that seems highly unlikely).
If it is part of the plan, it would be interesting to find out what 
exactly
the data model instance looks like that is passed from the key access to 
the
object key listing. Using fn:trace to do that might be a good first 
step.

Does this help?

Cheers,
Till

On 5 Aug 2016, at 7:42, Riyafa Abdul Hameed wrote:

> Hi,
>
> When looking for a good example for the documentation, I came across 
> the
> following issue in Object key listing and Array unboxing:
>
> The code
>
> let $x := {
> \u201cname\u201d : {\u201cid\u201d : 123, \u201cfirst\u201d : \u201cRiyafa\u201d, \u201cLast\u201d : 
> \u201cAbdul
> Hameed\u201d}}return $x(\u201cname\u201d)()
>
> returns
>
>  {\u201cid\u201d : 123, \u201cfirst\u201d : \u201cRiyafa\u201d, \u201cLast\u201d : \u201cAbdul 
> Hameed\u201d}
>
> but the code,
>
> let $x := {
> \u201cname\u201d : {\u201cid\u201d : 123, \u201cfirst\u201d : \u201cRiyafa\u201d, \u201cLast\u201d : 
> \u201cAbdul Hameed\u201d}}
> let $y := $x(\u201cname\u201d)return $y()
>
> returns
>
> id
> first
> Last
>
> But, as I understand both code should return:
>
> id
> first
> Last
>
> The same issue is present in Array unboxing:
> For example the code
>
> let $x := [[ \u201cmercury\u201d, \u201cvenus\u201d, \u201cearth\u201d, \u201cmars\u201d ],[ 
> \u201cmonday\u201d,
> \u201ctuesday\u201d, \u201cwednesday\u201d, \u201cthursday\u201d ]]return $x(1)()
>
> returns
>
> [ \u201cmercury\u201d, \u201cvenus\u201d, \u201cearth\u201d, \u201cmars\u201d ]
>
>
> while the code
>
> let $x := [[ \u201cmercury\u201d, \u201cvenus\u201d, \u201cearth\u201d, \u201cmars\u201d ],[ 
> \u201cmonday\u201d,
> \u201ctuesday\u201d, \u201cwednesday\u201d, \u201cthursday\u201d ]]
> let $y := $x(1)return $y()
>
> returns
>
> mercury
> venus
> earth
> mars
>
> Here also I think both should return:
>
> mercury
> venus
> earth
> mars
>
> I would like to know whether this is a language feature or if its an
> implementation issue. If it\u2019s an implementation issue I am not sure 
> I
> understand where the issue is. Any suggestions would be highly 
> appreciated.
> \u200b
> -- 
> Riyafa Abdul Hameed
> Undergraduate, University of Moratuwa
>
> Email: riyafa.12@cse.mrt.ac.lk
> Website: https://riyafa.wordpress.com/ <http://riyafa.wordpress.com/>
> <http://facebook.com/riyafa.ahf>  <http://lk.linkedin.com/in/riyafa>
> <http://twitter.com/Riyafa1>