title: Pyspark combineByKey list of tuples and count
body: <p>I have been having difficulty combining keyed tuples of two floats in an rdd into a list of theses keyed tuples into a list and the count of each, for each key.  I am using rdd. combineByKey to do this.  If I pass values to the three lambda’s outside of combineByKey I get the results I would expect, a key and a tuple of list of tuples and the count.  But, when I do this with combineByKey, I get a key and a tuple of list of one constant value and the count.  What may I be missing here?  I captured the REPL output below to illustrate. </p>
  
  <pre><code>j = jnd.take(2)
  </code></pre>
  
  <p><code>j</code>:</p>
  
  <pre><code>[[u'14225532965000', (0.2072, 82777.0)], [u'14217732824000', (0.20361902000000001, 77271.0)]]
  creCmb = (lambda v: ([v[1]], 1))
  mrgVal = (lambda x, v: (x[0]+[v[1]], x[1]+1))
  mrgCmb = (lambda x, y: (x[0]+y[0], x[1]+y[1]))
  x = creCmb(j[0])
  </code></pre>
  
  <p><code>x</code>:</p>
  
  <pre><code>([(0.2072, 82777.0)], 1) 
  m = mrgVal(x, j[1])
  </code></pre>
  
  <p><code>m</code>:</p>
  
  <pre><code>([(0.2072, 82777.0), (0.20361902000000001, 77271.0)], 2) 
  r = mrgCmb(m, m)
  </code></pre>
  
  <p><code>r</code>:</p>
  
  <pre><code>([(0.2072, 82777.0), (0.20361902000000001, 77271.0), (0.2072, 82777.0), (0.20361902000000001, 77271.0)], 4) 
  cmb = jnd.combineByKey(creCmb, mrgVal, mrgCmb) 
  cmb.count() 
  4513
  cmb.take(1)
  [(u'14225532026000', ([56917.0, 56917.0, 56917.0, 56917.0, 56917.0, 56917.0, 56917.0, 56917.0, 56917.0, 56917.0, 56917.0, 56917.0, 56917.0, 56917.0, 56917.0, 56917.0, 56917.0, 56917.0, 56917.0, 56917.0, 56917.0, 56917.0, 56917.0, 56917.0, 56917.0, 56917.0, 56917.0, 56917.0, 56917.0, 56917.0, 56917.0, 56917.0, 56917.0, 56917.0, 56917.0, 56917.0, 56917.0, 56917.0, 56917.0, 56917.0, 56917.0, 56917.0, 56917.0, 56917.0, 56917.0, 56917.0, 56917.0, 56917.0, 56917.0, 56917.0, 56917.0, 56917.0, 56917.0, 56917.0, 56917.0, ...
  ... 56917.0, 56917.0, 56917.0, 56917.0, 56917.0, 56917.0, 56917.0, 56917.0, 56917.0, 56917.0, 56917.0, 56917.0, 56917.0], 741))]
  </code></pre>