I am trying to convert an RDD to dataframe but it fails with an error:
org.apache.spark.SparkException: Job aborted due to stage failure: Task 0 in stage 2.0 failed 4 times, most recent failure: Lost task 0.3 in stage 2.0 (TID 11, 10.139.64.5, executor 0)
This is my code:
items = [(1,12),(1,float('Nan')),(1,14),(1,10),(2,22),(2,20),(2,float('Nan')),(3,300),
(3,float('Nan'))]
sc = spark.sparkContext
rdd = sc.parallelize(items)
itemsRdd = rdd.map(lambda x: Row(id=x[0], col1=int(x[1])))
df = itemsRdd.toDF() # The error is thrown in this line.