Java lang StringIndexOutOfBoundsException String index out of range

331    Asked by ChristopherPaterson in Python , Asked on Jul 17, 2021

 Hi,

I am getting an error in Spark. I tried to use groupByKey() function in scala. But it shows the below error.

ERROR executor.Executor: Exception in task 0.0 in stage 12.0 (TID 28)
java.lang.StringIndexOutOfBoundsException: String index out of range: 1

Can anyone tell me the reason?

Thank You

Answered by Bernadette Bond

 I also faced java.lang.stringindexoutofboundsexception: string index out of range: 0 problem. For my case I used map instead of flatMap. In flatMap each input item can be mapped to or more output items. So, you can try map in place of flatMap.

Thank You



Your Answer

Interviews

Parent Categories