load/save text file in spark

0 votes

I am using load command but it is loading only parquet 

val a = spark.read.load("employee.parquet")--works fine
val a=spark.read.load("employee.txt")--error

Why is this so?

Jul 22, 2019 in Apache Spark by Esha
1,335 views

1 answer to this question.

0 votes

The reason you are able to load employee.parquet and not employee.txt using load is that spark.read.load by default assumes that data source is in parquet format so it is able to load it but we can use format function which can be used to specify the different format and use the load function to load the data. Refer to this code:

val a =spark.read.format("csv").load("employee.txt")
answered Jul 22, 2019 by Giri

Related Questions In Apache Spark

0 votes
1 answer

Load custom delimited file in Spark

Refer to the following code: val sqlContext = ...READ MORE

answered Jul 24, 2019 in Apache Spark by Ritu
121 views
+1 vote
1 answer

How to read a data from text file in Spark?

Hey, You can try this: from pyspark import SparkContext SparkContext.stop(sc) sc ...READ MORE

answered Aug 6, 2019 in Apache Spark by Gitika
• 31,430 points
2,044 views
0 votes
1 answer

Efficient way to read specific columns from parquet file in spark

As parquet is a column based storage ...READ MORE

answered Apr 20, 2018 in Apache Spark by kurt_cobain
• 9,310 points
2,566 views
0 votes
1 answer

where can i get spark-terasort.jar and not .scala file, to do spark terasort in windows.

Hi! I found 2 links on github where ...READ MORE

answered Feb 13, 2019 in Apache Spark by Omkar
• 69,040 points
330 views
+1 vote
2 answers
+1 vote
1 answer

Hadoop Mapreduce word count Program

Firstly you need to understand the concept ...READ MORE

answered Mar 16, 2018 in Data Analytics by nitinrawat895
• 10,920 points
5,325 views
0 votes
1 answer

hadoop.mapred vs hadoop.mapreduce?

org.apache.hadoop.mapred is the Old API  org.apache.hadoop.mapreduce is the ...READ MORE

answered Mar 16, 2018 in Data Analytics by nitinrawat895
• 10,920 points
782 views
+1 vote
11 answers

hadoop fs -put command?

put syntax: put <localSrc> <dest> copy syntax: copyF ...READ MORE

answered Dec 7, 2018 in Big Data Hadoop by Aditya
32,509 views
+1 vote
1 answer

How can I write a text file in HDFS not from an RDD, in Spark program?

Yes, you can go ahead and write ...READ MORE

answered May 29, 2018 in Apache Spark by Shubham
• 13,380 points
3,449 views
0 votes
1 answer

load/save in spark

The reason why you are able to ...READ MORE

answered Jul 5, 2019 in Apache Spark by Firoz
414 views