title: How to iterate through dataframe without converting to dataset in spark?
body: <p>I have a dataframe through which I want to iterate, but I dont want to convert dataframe to dataset.
  We have to convert spark scala code to pyspark and pyspark does not support dataset.</p>
  
  <p>I have tried the following code with by converting to dataset</p>
  
  <pre><code>data in file:
  
  abc,a
  mno,b
  pqr,a
  xyz,b
  
  val a = sc.textFile("&lt;path&gt;")
  
  //creating dataframe with column AA,BB
  
  val b = a.map(x =&gt; x.split(",")).map(x =&gt;(x(0).toString,x(1).toString)).toDF("AA","BB") 
  
  b.registerTempTable("test")
  
  case class T(AA:String, BB: String)
  
  //creating dataset from dataframe
  
  val d = b.as[T].collect       
  
  d.foreach{ x=&gt;
      var m = spark.sql(s"select * from test where BB = '${x.BB}'")
      m.show()
  }
  
  Without converting to dataset it gives error i.e. with
  
  val d = b.collect
  
  d.foreach{ x=&gt;
      var m = spark.sql(s"select * from test where BB = '${x.BB}'")
      m.show()
  }
  </code></pre>
  
  <p>it gives error:
  error: value BB is not member of org.apache.spark.sql.ROW</p>