error reassingment to val

0 votes

I got this error when I tried assigning value to variable b in scala shell. Can  anyone tell why did I get this solution?

scala> b = 30
<console>:25: error: reassignment to val

Jul 5, 2019 in Apache Spark by nikhil
3,429 views

1 answer to this question.

0 votes

Hi,

This error will only generate when you try to add different value to the same variable. Check if you have already assigned any value to the variable 'b'. If you use:

scala> val b = 10 

then you try to assign another value to b, then it will give you this error because "val" is a constant it is not going to bearable anymore. If you define something as "val" it will not update that value.

Hope you understand the factor.

answered Jul 5, 2019 by Gitika
• 65,770 points

Related Questions In Apache Spark

0 votes
1 answer

Error Loading data to mysql in Spark

You have to use sqoop to export data ...READ MORE

answered Jul 11, 2019 in Apache Spark by Jishan
1,133 views
0 votes
1 answer

Error: Loading data to mysql

You have to use sqoop to export data ...READ MORE

answered Jul 23, 2019 in Apache Spark by Janan
696 views
0 votes
1 answer

error: Caused by: org.apache.spark.SparkException: Failed to execute user defined function.

Hi@akhtar, I think you got this error due to version mismatch ...READ MORE

answered Apr 22, 2020 in Apache Spark by MD
• 95,460 points
4,282 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
• 11,380 points
11,028 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
• 11,380 points
2,536 views
+2 votes
11 answers

hadoop fs -put command?

Hi, You can create one directory in HDFS ...READ MORE

answered Mar 16, 2018 in Big Data Hadoop by nitinrawat895
• 11,380 points
108,832 views
0 votes
5 answers

How to change the spark Session configuration in Pyspark?

You aren't actually overwriting anything with this ...READ MORE

answered Dec 14, 2020 in Apache Spark by Gitika
• 65,770 points
125,599 views
0 votes
1 answer

How to calculate the result of formula with Scala?

Hi, You can use a simple mathematical calculation ...READ MORE

answered Jul 1, 2019 in Apache Spark by Gitika
• 65,770 points
1,278 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP