2

I am new to Spark.

I am using Spark CollectionAccumulator to add list of customerobjects. For same customer I can have more than one object and all needs to get added in accumulator.

What is happening is If i have 3 objects with same customer all the customer objects is overwritten by the last object.

Eg :

{ "customerid": 2023, "email": "test.2023@test.se", "firstname": "Magdalena", "lastname": "Fridh", "mobile": "000000000",
"comments": null, "extracomments": null, "modifiedby": null } { "customerid": 2023, "email": "test.2023@test.se", "firstname": "Magdalena", "lastname": "Fridh", "mobile": "1111111111",
"comments": null, "extracomments": "testing", "modifiedby": null }

I am adding both object inside foreach to collectionaccumulator. but after getting added both object is having same attribute value. both object values got overwritten by last inserted object.

Could you please help me

Thanks.

MKS
  • 129
  • 1
  • 12

0 Answers0