 I have the below data frame in spark.I want to save it as text file without converting to RDD  as .rdd operation is very expensive.Please help me with solution
I have the below data frame in spark.I want to save it as text file without converting to RDD  as .rdd operation is very expensive.Please help me with solution
            Asked
            
        
        
            Active
            
        
            Viewed 129 times
        
    -4
            
            
         
    
    
        Hiranya Deka
        
- 242
- 6
- 15
- 
                    What do you mean it's expensive ? – eliasah Apr 07 '16 at 16:49
- 
                    I can save the data frame by converting it to RDD using Dataframe.rdd and then save the file as textfile.But i had read somewhre converting Dataframes into RDD using rdd is expensive.so i was looking for ways to save dataframes as text file without converting to RDD. – Hiranya Deka Apr 07 '16 at 17:06
- 
                    That's doesn't answer my question but ok. – eliasah Apr 07 '16 at 17:19
- 
                    1Possible duplicate of [How to export data from Spark SQL to CSV](http://stackoverflow.com/questions/31937958/how-to-export-data-from-spark-sql-to-csv) – eliasah Apr 07 '16 at 17:20
- 
                    Thanks for answering.This link doesnot answer either. – Hiranya Deka Apr 07 '16 at 17:41
1 Answers
2
            Try this
Df.write.format("com.databricks.spark.csv").option("delimiter",<text delimiter>).save(<filePath>)
Need to import the com.databricks.spark.csv first.
 
    
    
        Mr Lister
        
- 45,515
- 15
- 108
- 150
 
    
    
        Anudeep Varma
        
- 78
- 1
- 6