0

I created broadcast variables in spark java and called destroy() methods on them when i used get value() method i am still able to access the variables but when I used value method it is throwing error which is correct

OneCricketeer
  • 179,855
  • 19
  • 132
  • 245
vamshi
  • 19
  • 1

2 Answers2

1

The broadcast variable is read-only

From their documentation

"After the broadcast variable is created, it should be used instead of the value v in any functions run on the cluster so that v is not shipped to the nodes more than once. In addition, the object v should not be modified after it is broadcast in order to ensure that all nodes get the same value of the broadcast variable (e.g. if the variable is shipped to a new node later)."

opentokix
  • 843
  • 1
  • 5
  • 11
0

They are both to get the broadcasted value,but the value function will check if this broadcast is valid first. So I think we'd better use value instead of get value.