One method could be to either create a custom table off of a query with a JSON serde (for instance, I've used https://github.com/rcongiu/Hive-JSON-Serde).

Something like:

CREATE EXTERNAL TABLE my_tmp_table
ROW  FORMAT  SERDE  'org.openx.data.jsonserde.JsonSerDe'
STORED  AS  TEXTFILE
LOCATION '/path/to/file'
AS
<query>


In versions of hive later than 0.10 (which is what we're using), I believe that you may be able to do a similar thing with INSERT OVERWRITE, but I'm not sure whether it works with custom serdes (as opposed to custom delimiters). See https://issues.apache.org/jira/browse/HIVE-3682.

Hope this helps!

Andrew

On 2/20/14, 11:09 AM, Software Dev wrote:
When I run a query in the hive shell for an Avro field it displays it as json. How can I accomplish then when saving to a file?

Reply via email to