Bringing together the Apache Cassandra experts from the community and DataStax.

Want to learn? Have a question? Want to share your expertise? You are in the right place!

Not sure where to begin? Getting Started

 

question

cps-datastax_192628 avatar image
cps-datastax_192628 asked ·

Returning a Stream from DAO using Java driver 4.7.1

We used to use the java driver 3.x and I'm migrating to 4.x, I really like the new API btw.

Something that has confused me though is that in a @Dao I can @Select a PagingIterable<Foo> but not a Stream<Foo>. This seems a bit strange because PagingIterable exposes a spliterator so I can convert it into a stream with StreamSupport.stream(page.spliterator(), false). If its this easy to implement why doesn't the cassandra driver support returning streams, I feel like I might be missing something subtle.


java driver
10 |1000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

1 Answer

alexandre.dutra avatar image
alexandre.dutra answered ·

Thanks for the feedback, this is very much appreciated! I think your idea is a great enhancement for the mapper, so I logged JAVA-2830 for that.

Share
10 |1000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.