Multiple Take() in a linq confuse the evaluator

Description

When appending multiple Take() operators on a linq query, the query is not correctly evaluated.

For example, q.Take(10).Take(20) will return up to 20 items, instead of at most 10 items.

There is already an ignored unit test in Linq\PagingTests.cs (CustomersChainedTake), but I haven't found a matching issue for it.

Environment

None

Activity

Show:

Alex Zaytsev September 3, 2014 at 12:16 AM

Nope.

Ricardo Peres September 2, 2014 at 11:00 PM

Can this be closed?

Ricardo Peres May 6, 2013 at 2:07 PM

@David: totally agree. The problem is that in LINQ to Objects things are like Oskar described: if you issue two different Take, the minimum will be returned.

David Schmitt May 6, 2013 at 2:03 PM
Edited

@Ricardo: Take(vx) yields a sequence of at most vx items. Nothing manipulating that sequence later should have the power to return more than those x items.

@Oskar: I've tried enabling the Linq\PagingTests.cs#CustomersChainedTake test which does a double take (excuse the pun) but it fails. The same as my own application trying to use this.

Oskar Berggren May 6, 2013 at 12:53 PM
Edited

Several changes in 3.3.x have brought the NHibernate Linq semantics closer to .Net semantics. By that logic, .Take(vx).Take(vy) should give at most min(vx, vy) result rows.

Details

Assignee

Reporter

Labels

Components

Affects versions

Priority

Who's Looking?

Open Who's Looking?

Created May 6, 2013 at 11:25 AM
Updated September 3, 2014 at 12:16 AM
Who's Looking?