title: add sequence number column in dataframe usnig scala
body: <p>below is the logic to add sequence number column in dataframe. Its working as expected when I am reading data from delimited files. Today I have a new task to read the data from oracle table and add Sequence number and process further. I am facing issue with below logic to add sequence number in data frame when I read it from oracle table.</p>
  
  <blockquote>
    <p>oracleTableDF is my dataframe</p>
  </blockquote>
  
  <pre><code>   //creating Sequence no. logic for SeqNum
     val rowRDD = oracleTableDF.rdd.zipWithIndex().map(indexedRow =&gt; Row.fromSeq((((indexedRow._2.toLong+1)).toLong) +: indexedRow._1.toSeq)) 
  
    //creating StructType to add Seqnum in schema
          val newstructure = StructType(Array(StructField("SeqNum",LongType)).++(oracleTableDF.schema.fields))
  
    //creating new Data Frame with seqnum
    oracleTableDF = spark.createDataFrame(rowRDD, newstructure)
  </code></pre>
  
  <p>I am not able to locate the actual Issue. because the logic is working as expected in cluster when I read it from files. but facing some issue when I read it from oracle table. its working as expected in local mode also.</p>
  
  <blockquote>
    <p>below is the error :</p>
    
    <p>"ERROR scheduler.TaskSetManager: Task 0 in stage 1.0 failed 4 times; aborting job
    org.apache.spark.SparkException: Job aborted due to stage failure: Task 0 in stage 1.0 failed 4 times, most recent failure: Lost task 0.3 in stage 1.0 (TID 4, xxxx, executor 1): java.lang.NoClassDefFoundError: Could not initialize class oracleDataProcess$"</p>
  </blockquote>