prql icon indicating copy to clipboard operation
prql copied to clipboard

Allow Range start to equal Range End

Open florent-martineau opened this issue 4 years ago • 2 comments

Let's say you want to take the 20th row.

In the playground:

  • If I do take 20 I'll get the first 20 rows, not exactly the 20th.
  • If I do take 20..20 I get an error "Range end is before its start.".
  • If I do take 20..21 I'll get rows 20 and 21, then if I do take 1 it will throw me an error

There are workarounds, but I think it would be a nicer API to simply say take 20..20?

This fails because Range start cannot equal Range end. Maybe we could also start to equal end in a Range?

florent-martineau avatar Aug 31 '22 10:08 florent-martineau

This would be very welcome, and should be quite an easy chanhe — essentially removing that check (which I guess was added when we were thinking about doing 0-based indexing)

Thanks for the issue @florent-martineau

max-sixty avatar Aug 31 '22 17:08 max-sixty

Fixed by @Shuozeli in #946, thank you!

max-sixty avatar Sep 14 '22 19:09 max-sixty