Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Plain View
Pig >> mail # user >> UDF Complex Pig Object to JsonObject


Copy link to this message
-
UDF Complex Pig Object to JsonObject
>From within a Java UDF, I'm looking for an easy way to go from a complex
pig Object to a Json Object. The converse operation is also desired.

Use Case 1:
DataBag {(a,1.0)}  with Schema b1:bag{t1:tuple(t:chararray,s:double)}
return JsonObject {[a,1.0]}

Converse Use Case 1:
JsonObject {[a,1.0]}
return DataBag {(a,1.0)} Schema-less

Use Case 2:
Tuple (b,{(a,1.0)})  with Schema
t2:tuple(u:chararray,b1:bag{t1:tuple(t:chararray,s:double)})
return JsonObject {[b,{[a,1.0]}]}

Converse Use Case 2:
JsonObject {[b,{[a,1.0]}]}
return Tuple (b,{(a,1.0)}) Schema-less
Many Thanks,

-Dan