Hi Knut, I just opened this bug <https://github.com/jOOQ/jOOL/issues/357> in the jOOL project. (Feel free to continue this discussion in comments to that bug instead of in this thread.)
WRT your suggestion about using window functions in my DB query, unfortunately the DB I'm using (MongoDB) doesn't seem to offer such functions. Can you (1) think of any workaround for this behavior, or (2) give me a sense of when jOOL might be changed to "fix" this behavior, or (3) give me some hints about what the cause and possible solution in jOOL might be so I could possibly attempt to make and contribute a patch myself? Thanks. Nat On Wednesday, July 31, 2019 at 2:13:14 AM UTC-4, Knut Wannheden wrote: > > Hi Nat, > > Thanks for your message. > > At the moment this is how window() works, but your use case sounds > reasonable. Would you mind reporting and issue for this on GitHub ( > https://github.com/jOOQ/jOOL) so we can discuss and track this feature > request there? > > Since you mention that you are pulling the data from a database I am > however also wondering why you don't use window functions directly in your > DB query. That would surely be a lot more efficient, no? > > Knut > > On Tue, Jul 30, 2019 at 11:28 PM <[email protected] <javascript:>> wrote: > >> I'm building a *Seq* that contains *limit()* and *window()* terms and >> I'm seeing some surprising behavior: >> >> - If the *limit()* comes after the *window() *it appears that the >> iterator that the *Seq* is based on gets completely drained even >> though the stream terminates as expected after the number of items >> specified in the *limit()* are processed. >> - If the *limit()* comes before the *window()* the iterator is not >> drained. (The stream also terminates as expected.) >> >> I've attached a simple program that exhibits the behavior. >> >> >> In my real scenario, the iterator that the *Seq *is based on is an >> iterator on top of a DB cursor and the *limit()* comes after the >> *window()*. I really need the behavior to not be that the code tries to >> drain this iterator--i.e., read a ton of rows from the DB. >> >> >> Is this a bug or just the way things work? >> >> >> Thanks. >> >> >> Nat >> >> >> -- >> You received this message because you are subscribed to the Google Groups >> "jOOQ User Group" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected] <javascript:>. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/jooq-user/9114e574-7d05-4109-95f8-c9700b38fc32%40googlegroups.com >> >> <https://groups.google.com/d/msgid/jooq-user/9114e574-7d05-4109-95f8-c9700b38fc32%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> > -- You received this message because you are subscribed to the Google Groups "jOOQ User Group" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/jooq-user/a979bc20-2658-45e8-b23b-e4847d5f62a9%40googlegroups.com.
