[
https://issues.apache.org/jira/browse/ASTERIXDB-1212?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Yingyi Bu resolved ASTERIXDB-1212.
----------------------------------
Resolution: Fixed
> Close-type list doesn't handle NULL well
> -----------------------------------------
>
> Key: ASTERIXDB-1212
> URL: https://issues.apache.org/jira/browse/ASTERIXDB-1212
> Project: Apache AsterixDB
> Issue Type: Bug
> Components: AsterixDB, Data Model
> Reporter: Jianfeng Jia
> Assignee: Yingyi Bu
>
> First, I observed the out of range access for the closed-type list and
> open-type list are quite different:
> {code}
> // closed type:
> let $all := [ { "ka":"a1", "kb":"b1"},
> { "ka":"a2", "kb":"b2"}]
> return $all[3].ka
> {code}
> It returns a "", I think it should be null.
> If I change the type to a hytogenous type like below
> {code}
> // open type:
> let $all := [ { "ka":"a1", "kb":"b1"},
> { "ka":2, "kb":"b2"}]
> return $all[3].ka
> {code}
> It returns a null as expected.
> Furthermore, the closed-type will return the wrong result by just access
> field by index other than by name. Here is example
> {code}
> let $all := [ { "ka":"a1", "kb":"b1"},
> { "ka":"a2", "kb":"b2"}]
> for $x in $all
> group by $k := $x.kb with $x
> return { "g": $k, "s1": $x[1].ka}
> {code}
> It returns
> {code}
> { "g": "b1", "s1": "b1" }
> { "g": "b2", "s1": "b2" }
> {code}
> It seems it skipped some offset directly without verify if the record is null
> or not.
> The open type doesn't have this problem. The following code
> {code}
> let $all := [ { "ka":"a1", "kb":"b1"},
> { "ka":2, "kb":"b2"}] // change ka to 2 to make a
> heterogenous type list
> for $x in $all
> group by $k := $x.kb with $x
> return { "g": $k, "s1": $x[1].ka}
> {code}
> will always return
> {code}
> { "g": "b1", "s1": null }
> { "g": "b2", "s1": null }
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)