Error : split value is not a member of org.apache.spark.sql.Row

0 votes

Hi,

Error : split value is not a member of org.apache.spark.sql.Row

I am working on eclipse EdurekaVM, when adding split(",") i am getting this error, please help.

val rdd2col = spark.read.csv("file:///home/edureka/rk/2Cols.csv")
val names = rdd2col.map(line => line.split(",")(0))
Jul 10 in Apache Spark by Kiran
29 views

1 answer to this question.

0 votes

spark.read.csv is used when loading into a dataframe. The error message that you are getting states that the 'split' function that you are using is not a member of spark.sql. It is searching split in spark.sql because of the loading technique.

Please refer to the below commands for your requirement:

val rdd2col = sc.textFile("file:///home/edureka/Documents/datasets/emp.csv")
val names = rdd2col.map(line => line.split(",")(1))
names.collect()
answered Jul 10 by Rishi

Related Questions In Apache Spark

0 votes
1 answer

Error: value textfile is not a member of org.apache.spark.SparkContext

Hi, Regarding this error, you just need to change ...READ MORE

answered Jul 4 in Apache Spark by Gitika
• 19,720 points
20 views
0 votes
1 answer
0 votes
1 answer

Can I read a CSV represented as a string into Apache Spark?

You can use the following command. This ...READ MORE

answered May 3, 2018 in Apache Spark by kurt_cobain
• 9,240 points
46 views
0 votes
1 answer

cache tables in apache spark sql

Caching the tables puts the whole table ...READ MORE

answered May 4, 2018 in Apache Spark by Data_Nerd
• 2,360 points
528 views
0 votes
0 answers
0 votes
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,110 points
2,047 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,110 points
196 views
0 votes
10 answers

hadoop fs -put command?

copy command can be used to copy files ...READ MORE

answered Dec 7, 2018 in Big Data Hadoop by Sujay
10,476 views
0 votes
1 answer

org.apache.spark.sql.AnalysisException: cannot resolve given input columns

The string Productivity has to be enclosed between single ...READ MORE

answered Jul 10 in Apache Spark by Tina
63 views