ARTICLE AD BOX
I currently have code like this:
try (var cursor = query().fetchSize(1000).fetchLazy()) { cursor.formatCSV(out); }Does exactly what I want - lazily fetches (my results are gigantic and would never all fit in memory) and formats as CSV correctly.
However, I now need to preprocess the records in a way that will result in splitting some records into many.
Similar to:
try (var stream = query().fetchSize(1000).stream()) { stream .mapMulti(...) //split the records as needed .forEach(r -> r.formatCSV(out)); }but this has a number of problems. For one, I'll get the header printed for each row. Also, calling formatCSV() on a record wraps the record in a Result first, which in my case means allocating tens of millions of objects for effectively nothing.
What can I do to make this better?
16.2k13 gold badges75 silver badges130 bronze badges
3
Explore related questions
See similar questions with these tags.
