trathschlag
03/25/2020, 11:58 AMBob Glamm
03/25/2020, 1:21 PMfs2 for Arrow?raulraja
03/25/2020, 5:02 PMsimon.vergauwen
03/25/2020, 5:04 PMIO.trathschlag
03/26/2020, 9:36 AMfs2 seems to support what I am looking for but I have never used scala.
It is a quite easy use case: I get lines from a database in chunks. The chunk-fetching is async. If a value of the line is the same as one of a line fetched before, they get merged. I want to get N lines after merging and I do not know in advance how many lines have to be merged.
So I want to fold over this async stream of chunks and terminate when my result list reaches a certain size.simon.vergauwen
03/26/2020, 9:40 AMRef or Queue and IO.
I.e. an unbounded Queue would allow you to insert N lines from the database, when using simple recursion you can pass the previous line along as param to compare with the next line. When finished you can simply takeAll from the Queue.
Queue will be released next week in 0.10.5, and Ref allows for something but it acts like an AtomicReference rather than a Queue so you’d be required to merge everything in a List manually. Assuming you’d do simple List concatenation with List#plus that could be relatively simple as well.simon.vergauwen
03/26/2020, 9:40 AMtrathschlag
03/26/2020, 9:45 AMQueuesimon.vergauwen
03/26/2020, 9:47 AMQueue already it’s available in the 0.10.5-SNAPSHOT. We’re currently just in the process of the last finishing touches.simon.vergauwen
03/26/2020, 6:43 PMsimon.vergauwen
03/26/2020, 6:43 PMtrathschlag
03/28/2020, 10:14 AMMap but this example is completely sufficient for me. And just that I understand correctly: process is not really 'recursive', right? It terminates immediately and returns either the final value or the recipe you have to execute further to get there. (I am a functional newbie ;))simon.vergauwen
03/28/2020, 10:15 AMor the recipe you have to execute further to get thereThat’s the recursion part 😉 It’s quite simple with
IO tho and IO guarantees stack-safety etc so no need to worry about that!trathschlag
03/28/2020, 10:17 AMsimon.vergauwen
03/28/2020, 10:18 AM