GitHub user xelzmm opened a pull request:
https://github.com/apache/hive/pull/15
fix bug when extract a list of list with key
line 250 should be out of the for-loop
For example
json = '{"h":[1, [2, 3], {"i": 0}, [{"p": 11}, {"p": 12}, {"pp": 13}]}'
get_json_object(json, '$.h[*][0]') should return back the first node(if
exists) of every childrenof '$.h'
which specifically should be
[2,{"p":11}]
but hive returns only
2
because when hive pick the node '2' out, the tmp_jsonList will change to a
list only contains one node '2':
[2]
then it was assigned to variable jsonList, in the next loop, value of i
would be 2 which is greater than the size(always 1) of jsonList, then the loop
broke out.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/xelzmm/hive patch-1
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/hive/pull/15.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #15
----
commit 314843882c01fac59ae70b358a9d8858a99d5e52
Author: Ma Ming <[email protected]>
Date: 2014-05-08T04:01:57Z
fix bug when extract a list of list with key
line 250 should be out of the for-loop
For example
json = '{"h":[1, [2, 3], {"i": 0}, [{"p": 11}, {"p": 12}, {"pp": 13}]}'
get_json_object(json, '$.h[*][0]') should return back the first node of
every children(if exists) of '$.h'
which specifically should be
[2,{"p":11}]
but hive returns only
2
because whe hive pick the node '2' out, the tmp_jsonList will change to a
list only contains one node '2':
[2]
then it was assigned to variable jsonList, in the next loop, value of i
would be 2 which is greater than the size(always 1) of jsonList, then the loop
broke out.
----
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---