title: Combine multiple dict to another dict in pyspark rdd
body: <p>I have a dataframe as follow:</p>
  
  <pre><code>from pyspark.sql import SparkSession
  
  sqlContext = SparkSession.builder.appName("test").enableHiveSupport().getOrCreate()
  data = [(1,2,0.1,0.3),(1,2,0.1,0.3),(1,3,0.1,0.3),(1,3,0.1,0.3),
          (11, 12, 0.1, 0.3),(11,12,0.1,0.3),(11,13,0.1,0.3),(11,13,0.1,0.3)]
  
  trajectory_df = sqlContext.createDataFrame(data, schema=['grid_id','rider_id','lng','lat'])
  trajectory_df.show()
  
  +-------+--------+---+---+
  |grid_id|rider_id|lng|lat|
  +-------+--------+---+---+
  |      1|       2|0.1|0.3|
  |      1|       2|0.1|0.3|
  |      1|       3|0.1|0.3|
  |      1|       3|0.1|0.3|
  |     11|      12|0.1|0.3|
  |     11|      12|0.1|0.3|
  |     11|      13|0.1|0.3|
  |     11|      13|0.1|0.3|
  +-------+--------+---+---+
  </code></pre>
  
  <p>I want to merge data from the same grid into dict. Where <code>rider_id</code> is the key of dict and latitude and longitude is the value of dict. </p>
  
  <p>The results I expect are as follows：</p>
  
  <pre><code>[(1, {3:[[0.1, 0.3], [0.1, 0.3]],2:[[0.1, 0.3], [0.1, 0.3]]}),
   (11,{13:[[0.1, 0.3], [0.1, 0.3]],12:[[0.1, 0.3], [0.1, 0.3]]})]
  </code></pre>
  
  <p>I can use <code>groupByKey()</code> to group <code>grid_id</code>.</p>
  
  <pre><code>def trans_point(row):
      return ((row.grid_id, row.rider_id), [row.lng, row.lat])
  trajectory_df = trajectory_df.rdd.map(trans_point).groupByKey().mapValues(list)
  print(trajectory_df.take(10))
  
  [((1, 3), [[0.1, 0.3], [0.1, 0.3]]), ((11, 13), [[0.1, 0.3], [0.1, 0.3]]), ((1, 2), [[0.1, 0.3], [0.1, 0.3]]), ((11, 12), [[0.1, 0.3], [0.1, 0.3]])]
  </code></pre>
  
  <p>But I can't get the result when I combine multiple dict:</p>
  
  <pre><code>trajectory_df = trajectory_df.map(lambda x:(x[0][0],{x[0][1]:x[1]})).reduceByKey(lambda x,y:x.update(y))
  print(trajectory_df.take(10))
  [(1, None), (11, None)]
  </code></pre>
  
  <p>I hope it's <strong>done under the RDD type</strong> for some reasons. How can I achieve it? Thanks in advance.</p>