title: Transform bag of key-value tuples to map in Apache Pig
body: <p>I am new to Pig and I want to convert a bag of tuples to a map with specific value in each tuple as key. Basically I want to change:</p>
  
  <p><code>{(id1, value1),(id2, value2), ...}</code> into <code>[id1#value1, id2#value2]</code></p>
  
  <p>I've been looking around online for a while, but I can't seem to find a solution. I've tried:</p>
  
  <pre><code>bigQMap = FOREACH bigQFields GENERATE TOMAP(queryId, queryStart);
  </code></pre>
  
  <p>but I end up with a bag of maps (e.g. <code>{[id1#value1], [id2#value2], ...}</code>), which is not what I want. How can I build up a map out of a bag of key-value tuple?</p>
  
  <p>Below is the specific script I'm trying to run, in case it's relevant</p>
  
  <pre><code>rawlines = LOAD '...' USING PigStorage('`');
  bigQFields = FOREACH bigQLogs GENERATE GFV(*,'queryId')
     as queryId, GFV(*, 'queryStart')
     as queryStart;
  bigQMap = ?? how to make a map with queryId as key and queryStart as value ?? ;
  </code></pre>