title: Generate key value pairs from spark dataframe or RDD with column name present in key
body: <p>I have a spark dataframe for which I need key value pairs as shown below. I specifically need the column name in the key. I want to do this using single  mapper pass.</p>
  
  <p>Original Dataset:</p>
  
  <p><a href="https://i.stack.imgur.com/7QStY.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/7QStY.png" alt="enter image description here"></a></p>
  
  <p>Expected key value pair:(Attribute_Name,Attribute_Value,Class),1            </p>
  
  <p>Expected result after single pass of mapper: </p>
  
  <p>Expected Dataset</p>
  
  <p><a href="https://i.stack.imgur.com/ehtK0.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ehtK0.png" alt="enter image description here"></a></p>