facebook/presto — pull request #1396 by nezihyigitbasi (2014-06-16 16:44:11+00:00)
Title: Issue 1377: json_tuple implementation

This pull request implements a json_tuple function that's similar to Hive's, except that this one is **not** a table generating function. Instead, this function returns a json string created out of the user specified fields as the second argument to the function.

**Example:**

presto:default> select json_tuple('{ "x": 1, "y": 2, "z": { "x": "inner_x_val" }, "t": [1,2,3] }', '["x", "t"]'); // extract the keys 'x' and 't'
**>>** {"x":1,"t":[1,2,3]}

presto:default> select json_extract( json_tuple('{ "x": 1, "y": 2, "z": { "x": "inner_x_val" }, "t": [1,2,3] }', '["x", "t"]'), '$.t[0]' ); //get the first element of t
**>>** 1