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 4, 2019 in Apache Spark by nikhil
354 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 4, 2019 by Gitika
• 65,870 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
285 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
142 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,140 points
943 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
7,115 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
1,141 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
51,697 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 13, 2020 in Apache Spark by Gitika
• 65,870 points
54,048 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,870 points
314 views