apache pig - How to read data from data bag within a PIG script -


i have databag following format {([channelname#{ (bigxml,[])} ])}

  • databag consists of 1 item tuple.
  • tuple consists of item map.
  • map of type map between channel names , values.
  • here value of type databag, consists of 1 tuple.
  • the tuple consists of 2 items 1 charrarray (very big string) , other map

i have udf emits above bag.

now need invoke udf passing tuple within databag against given channel map.

assuming there not data bag , tuple ([channelname#{ (bigxml,[])} ]) can access data using $0.$0#'stdoutchannel' tuple inside bag {([channelname#{ (bigxml,[])} ])} if $0.$0.$0#'stdoutchannel' (prepend $0), following error error 1052: cannot cast bag schema bag({bytearray}) map

how can access data within data bag?

try break problem down little.

let's inner bag:

mybag = $0.$0#'stdoutchannel'; 

first, can illustrate or dump this?

what can bag? foreach on tuples inside.

a = foreach mybag {     generate $0 mychararray, $1 mymap };  illustrate a; -- or if doesn't work dump a; 

can try interactively , maybe edit question little more details result of trying these things.

some editing hints stackoverflow:

  • put backticks around code (`illustrate`)
  • indent code blocks 4 spaces on each line

Comments

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -