title: Pig HBaseStorage - How to Generate Dynamic Column Names and a Dynamic Number of Column Qualifiers from a DataBag?
body: <p>A has a 1:M relationship with B.</p>
  
  <pre><code>A = LOAD ... AS (
      a_id:char
      ,...
  );
  B = LOAD ... AS (
      a_id:chararray
      ,b_id:chararray
      ,...
  );
  JOINED = JOIN A BY a_id, B BY a_id;
  GROUPED = GROUP JOINED BY a::a_id;
  </code></pre>
  
  <p>This would create a DataBag with the following schema:</p>
  
  <pre><code>{group: chararray, JOINED: {(A:a_id, ..., B::a_id, B::b_id, ...)}}
  </code></pre>
  
  <p>For example:</p>
  
  <pre><code>(1, {(1, ..., 1, 1, ...)})
  (2, {(2, ..., 2, 2, ...), (2, ..., 2,3, ...), (2, ...,2,4, ...)})
  (3, {(3, ..., 3, 5, ...)})
  </code></pre>
  
  <p>For these three rows, this is how the corresponding HBase results would look like:</p>
  
  <pre><code>rowkey = 1, A:a_id=1, ... B:b1|a_id=1, B:b1|b_id:=1
  rowkey = 2, A:a_id=2, ... B:b2|a_id=2, B:b2|b_id=2, ..., B:b3|a_id=2, B:b3|b_id=3, ..., B:b4|a_id=2, B:b4|b_id=4, ...
  rowkey = 3, A:a_id=3, ..., B:b5|a_id=3, B:b5|b_id = 5
  </code></pre>
  
  <p>How can I import this DataBag into HBase using the above logic?</p>
  
  <p>In order to do this I need to generate dynamic column qualifier names, the number of which would be dependent on the number of subtuples in the DataBag.</p>