You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hive.apache.org by Alexander Pivovarov <ap...@gmail.com> on 2015/03/22 07:07:58 UTC

Review Request 32374: HIVE-1575 get_json_object does not support JSON array at the root level

-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/32374/
-----------------------------------------------------------

Review request for hive, Jason Dere and namit jain.


Bugs: HIVE-1575
    https://issues.apache.org/jira/browse/HIVE-1575


Repository: hive-git


Description
-------

HIVE-1575 get_json_object does not support JSON array at the root level


Diffs
-----

  ql/src/java/org/apache/hadoop/hive/ql/udf/UDFJson.java 781286613d1b939f684e7be95341adaeeca0c60e 
  ql/src/test/org/apache/hadoop/hive/ql/udf/TestUDFJson.java PRE-CREATION 
  ql/src/test/queries/clientpositive/udf_get_json_object.q 05f7f5a9811bc028565d88f08fc36058cd85148d 
  ql/src/test/results/clientpositive/udf_get_json_object.q.out 51f0c1510d101189e281f40ffd7bcd7f1ed97c84 

Diff: https://reviews.apache.org/r/32374/diff/


Testing
-------


Thanks,

Alexander Pivovarov


Re: Review Request 32374: HIVE-1575 get_json_object does not support JSON array at the root level

Posted by Alexander Pivovarov <ap...@gmail.com>.

> On March 24, 2015, 11:30 p.m., Jason Dere wrote:
> > ql/src/java/org/apache/hadoop/hive/ql/udf/UDFJson.java, line 136
> > <https://reviews.apache.org/r/32374/diff/1/?file=902256#file902256line136>
> >
> >     I don't know anything about JsonPath - so "$[0]", "[0]", "$.[0]" are all valid JsonPath? Should the path string always start with $ to be consistent with the rest of the syntax?

Hi Jason, thank you for looking at the patch.
$[0] and $.[0] are both valid.
You can try to evaluate jsonpathes here online http://ashphy.com/JSONPathOnlineEvaluator/

I'll change the code to require jsonpath to start with $[ or $.


- Alexander


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/32374/#review77672
-----------------------------------------------------------


On March 22, 2015, 6:07 a.m., Alexander Pivovarov wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/32374/
> -----------------------------------------------------------
> 
> (Updated March 22, 2015, 6:07 a.m.)
> 
> 
> Review request for hive, Jason Dere and namit jain.
> 
> 
> Bugs: HIVE-1575
>     https://issues.apache.org/jira/browse/HIVE-1575
> 
> 
> Repository: hive-git
> 
> 
> Description
> -------
> 
> HIVE-1575 get_json_object does not support JSON array at the root level
> 
> 
> Diffs
> -----
> 
>   ql/src/java/org/apache/hadoop/hive/ql/udf/UDFJson.java 781286613d1b939f684e7be95341adaeeca0c60e 
>   ql/src/test/org/apache/hadoop/hive/ql/udf/TestUDFJson.java PRE-CREATION 
>   ql/src/test/queries/clientpositive/udf_get_json_object.q 05f7f5a9811bc028565d88f08fc36058cd85148d 
>   ql/src/test/results/clientpositive/udf_get_json_object.q.out 51f0c1510d101189e281f40ffd7bcd7f1ed97c84 
> 
> Diff: https://reviews.apache.org/r/32374/diff/
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> Alexander Pivovarov
> 
>


Re: Review Request 32374: HIVE-1575 get_json_object does not support JSON array at the root level

Posted by Jason Dere <jd...@hortonworks.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/32374/#review77672
-----------------------------------------------------------



ql/src/java/org/apache/hadoop/hive/ql/udf/UDFJson.java
<https://reviews.apache.org/r/32374/#comment125843>

    I don't know anything about JsonPath - so "$[0]", "[0]", "$.[0]" are all valid JsonPath? Should the path string always start with $ to be consistent with the rest of the syntax?


- Jason Dere


On March 22, 2015, 6:07 a.m., Alexander Pivovarov wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/32374/
> -----------------------------------------------------------
> 
> (Updated March 22, 2015, 6:07 a.m.)
> 
> 
> Review request for hive, Jason Dere and namit jain.
> 
> 
> Bugs: HIVE-1575
>     https://issues.apache.org/jira/browse/HIVE-1575
> 
> 
> Repository: hive-git
> 
> 
> Description
> -------
> 
> HIVE-1575 get_json_object does not support JSON array at the root level
> 
> 
> Diffs
> -----
> 
>   ql/src/java/org/apache/hadoop/hive/ql/udf/UDFJson.java 781286613d1b939f684e7be95341adaeeca0c60e 
>   ql/src/test/org/apache/hadoop/hive/ql/udf/TestUDFJson.java PRE-CREATION 
>   ql/src/test/queries/clientpositive/udf_get_json_object.q 05f7f5a9811bc028565d88f08fc36058cd85148d 
>   ql/src/test/results/clientpositive/udf_get_json_object.q.out 51f0c1510d101189e281f40ffd7bcd7f1ed97c84 
> 
> Diff: https://reviews.apache.org/r/32374/diff/
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> Alexander Pivovarov
> 
>


Re: Review Request 32374: HIVE-1575 get_json_object does not support JSON array at the root level

Posted by Jason Dere <jd...@hortonworks.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/32374/#review77767
-----------------------------------------------------------



ql/src/java/org/apache/hadoop/hive/ql/udf/UDFJson.java
<https://reviews.apache.org/r/32374/#comment125968>

    what is the reason for the pathString.length() == 2 check in here? I'm assuming the jsonPath logic later on is able to take care of any cases handled here? Or is it simply to try to quickly handle this particular error case? If this is the reason, I would say just let the later logic handle it, I would not think this would be a common source of user error for this function.



ql/src/java/org/apache/hadoop/hive/ql/udf/UDFJson.java
<https://reviews.apache.org/r/32374/#comment125964>

    I don't think it should blindly return the jsonString without parsing in this case. When jsonString is invalid JSON, I would think the behavior should be to return NULL.


- Jason Dere


On March 25, 2015, 2:33 a.m., Alexander Pivovarov wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/32374/
> -----------------------------------------------------------
> 
> (Updated March 25, 2015, 2:33 a.m.)
> 
> 
> Review request for hive, Jason Dere and namit jain.
> 
> 
> Bugs: HIVE-1575
>     https://issues.apache.org/jira/browse/HIVE-1575
> 
> 
> Repository: hive-git
> 
> 
> Description
> -------
> 
> HIVE-1575 get_json_object does not support JSON array at the root level
> 
> 
> Diffs
> -----
> 
>   ql/src/java/org/apache/hadoop/hive/ql/udf/UDFJson.java 781286613d1b939f684e7be95341adaeeca0c60e 
>   ql/src/test/org/apache/hadoop/hive/ql/udf/TestUDFJson.java PRE-CREATION 
>   ql/src/test/queries/clientpositive/udf_get_json_object.q 05f7f5a9811bc028565d88f08fc36058cd85148d 
>   ql/src/test/results/clientpositive/udf_get_json_object.q.out 51f0c1510d101189e281f40ffd7bcd7f1ed97c84 
> 
> Diff: https://reviews.apache.org/r/32374/diff/
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> Alexander Pivovarov
> 
>


Re: Review Request 32374: HIVE-1575 get_json_object does not support JSON array at the root level

Posted by Alexander Pivovarov <ap...@gmail.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/32374/
-----------------------------------------------------------

(Updated March 25, 2015, 8:29 p.m.)


Review request for hive, Jason Dere and namit jain.


Changes
-------

fixed 2 issues with initial json path validation


Bugs: HIVE-1575
    https://issues.apache.org/jira/browse/HIVE-1575


Repository: hive-git


Description
-------

HIVE-1575 get_json_object does not support JSON array at the root level


Diffs (updated)
-----

  ql/src/java/org/apache/hadoop/hive/ql/udf/UDFJson.java 781286613d1b939f684e7be95341adaeeca0c60e 
  ql/src/test/org/apache/hadoop/hive/ql/udf/TestUDFJson.java PRE-CREATION 
  ql/src/test/queries/clientpositive/udf_get_json_object.q 05f7f5a9811bc028565d88f08fc36058cd85148d 
  ql/src/test/results/clientpositive/udf_get_json_object.q.out 51f0c1510d101189e281f40ffd7bcd7f1ed97c84 

Diff: https://reviews.apache.org/r/32374/diff/


Testing
-------


Thanks,

Alexander Pivovarov


Re: Review Request 32374: HIVE-1575 get_json_object does not support JSON array at the root level

Posted by Alexander Pivovarov <ap...@gmail.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/32374/
-----------------------------------------------------------

(Updated March 25, 2015, 2:33 a.m.)


Review request for hive, Jason Dere and namit jain.


Changes
-------

require jsonpath to start with $[ or $.


Bugs: HIVE-1575
    https://issues.apache.org/jira/browse/HIVE-1575


Repository: hive-git


Description
-------

HIVE-1575 get_json_object does not support JSON array at the root level


Diffs (updated)
-----

  ql/src/java/org/apache/hadoop/hive/ql/udf/UDFJson.java 781286613d1b939f684e7be95341adaeeca0c60e 
  ql/src/test/org/apache/hadoop/hive/ql/udf/TestUDFJson.java PRE-CREATION 
  ql/src/test/queries/clientpositive/udf_get_json_object.q 05f7f5a9811bc028565d88f08fc36058cd85148d 
  ql/src/test/results/clientpositive/udf_get_json_object.q.out 51f0c1510d101189e281f40ffd7bcd7f1ed97c84 

Diff: https://reviews.apache.org/r/32374/diff/


Testing
-------


Thanks,

Alexander Pivovarov