hadoop - How do I flatten nested Avro records in a Pig query? -


avro schema looks this:

{   "type" : "record",   "name" : "name1",   "fields" :   [     {       "name" : "f1",       "type" : "string"     },     {       "name" : "f2",       "type" :       {         "type" : "array",         "items" :         {           "type" : "record",           "name" : "name2",           "fields" :           [             {               "name" : "time",               "type" : [ "float", "int", "double", "long" ]             },           ]         }       }     }   ] } 

after reading in pig:

grunt> = load 'data' using avrostorage(); grunt> describe a; a: {f1: chararray,f2: {array_elem: (time: (float: float,int: int,double: double,long: long))}} 

what want bag of (f1:chararray, timestamp:double). did:

grunt> b = foreach generate f1, f2.time timestamp; grunt> describe b; b: {f1: chararray,timestamp: {(time: (float: float,int: int,double: double,long: long))}} 

so how flatten record?

i'm new pig, avro , don't know i'm trying makes sense. help.


Comments

Popular posts from this blog

yii2 - Yii 2 Running a Cron in the basic template -

asp.net - 'System.Web.HttpContext' does not contain a definition for 'GetOwinContext' Mystery -

mercurial graft feature, can it copy? -