Parsing Text file and loading it into a DataFrame

Just idea, you can check how to implement dataframe use spark. Check documentation in here : https://spark.apache.org/docs/latest/sql-programming-guide.html .

May be useful.