1 Answer
1

Is it OK to do IO inside java 8 streams?
Depends on what you mean by OK.

»OK« in the sense of does it work: yes why shouldn't it.

»OK« in the sense of should I: No!

That is not encouraged. It doesn't make sense,retrieving first a user with a call to the database and then retrive contacts with n more requests simply because you wanted the name of the contact, when one request will do?

Enhance your query in joining in the contacts' name and build an aggregate column, which contains the information needed.

As I understand relationship between Cassandra and Spark your way doesn't minimize requests, only wrap them in one request to Spark, but Spark anyway does exactly same set of requests to Cassandra.
– Ivan ZelenskyyFeb 26 '16 at 10:21