0

I'm looking to parse out a json string in HIVE using Serde, but don't see an easy way of doing so from a string already in HIVE tables. Do you know how I can do this?

To make my scenario more understandable, here is a butchered example I may try:

ADD JAR hdfs:////user/d/libs/json-serde-1.3.8-jar-with-dependencies.jar;

CREATE Temporary TABLE TN (v string);
Insert overwrite table TN select '
[
    {"t1":31646203,"t2":"h","s1":
       [
         {"r1":"w","r2":"w2"}
       ]
     }
]' as v;

CREATE TABLE deserializeThis (jsonDeserialized array<struct<t1:int,t2:string,s1:array<struct<r1:string, r2:string>>>>)
ROW FORMAT SERDE 'org.openx.data.jsonserde.JsonSerDe';

Insert overwrite table deserializeThis select v FROM TN;

Thanks for all your help!

E_net4
  • 27,810
  • 13
  • 101
  • 139
user2740775
  • 77
  • 1
  • 6

1 Answers1

0

In order to use SerDe we can operate on the file system level. To do this, we can push the information into a table and read from that location using SerDe.

This answer describes the above: How can I parse a Json column of a Hive table using a Json serde?

user2740775
  • 77
  • 1
  • 6