Following is my REPL output. I am not sure why string.split does not work here.
val s = \"Pedro|groceries|apple|1.42\" s: java.lang.String = Pedro|groceries|
Split takes a regex as first argument, so your call is interpreted as "empty string or empty string". To get the expected behavior you need to escape the pipe character "\\|".