title: Modify key of an RDD
body: <p>My RDD is of below structure - </p>
  
  <pre><code>Key| Val1   |Val2  |
  314 | 850   |10468.714
  315 | 850   |20468.714
  316 | 873   |14630.532
  317 | 676   |21450.78
  318 | 475   |23247.512
  319 | 850   |10468.714
  320 | 850   |10468.714
  321 | 850   |20468.714
  322 | 873   |14630.532
  323 | 676   |21450.78
  324 | 475   |23247.512
  </code></pre>
  
  <p>I Run two filter operations with some offset value -</p>
  
  <p><strong>Filter Op1:</strong> </p>
  
  <p>Offset = 0 and time scope from 320 to 324</p>
  
  <p>All the keys having value from (320-0) to (324-0) are filtered</p>
  
  <p>FilteredRDD1:</p>
  
  <pre><code>Key| Val1   |Val2  |
  320 | 850   |10468.714
  321 | 850   |20468.714
  322 | 873   |14630.532
  323 | 676   |21450.78
  324 | 475   |23247.512
  </code></pre>
  
  <p><strong>Filter Op2:</strong> </p>
  
  <p>Offset = 6 and time scope from 320 to 324</p>
  
  <p>All the keys having value from (320-6):314 to (324-6):318 are filtered</p>
  
  <p>FilteredRDD2:</p>
  
  <pre><code>Key| Val1   |Val2  |
  314 | 850   |10468.714
  315 | 850   |20468.714
  316 | 873   |14630.532
  317 | 676   |21450.78
  318 | 475   |23247.512
  </code></pre>
  
  <p><em><strong>Action</strong></em></p>
  
  <p>I want to <strong>multiply</strong> Val1 from FilteredRDD1 with Val2 from FilteredRDD2.</p>
  
  <p>I can think of an option wherein -</p>
  
  <ol>
  <li><p>Modify key of FilteredRDD2 using offset so that the keys of both the FilteredRDDs are same</p></li>
  <li><p>Do a join on the un-modified FilteredRDD and the modified FilteredRDD</p></li>
  <li><p>Perform a map operation on the joined RDD and multiply Val1 with Val2</p></li>
  </ol>
  
  <p>Any other better option available so that there is lesser shuffling and lesser intermediate operations.</p>
  
  <p>TIA!</p>