Of course, silly me. I was forgetting that it returns a candidate list.
Thanks Sjoerd

On Tue, 25 Aug 2020, 08:54 Sjoerd Mullender, <sjoerd@monetdb.org> wrote:


On 24/08/2020 19.43, Roberto Cornacchia wrote:
> Hi, I was looking at pcre.c for some inspiration and found something
> suspicious.
>
> At the end of both pcre_likeselect() and re_likeselect():
>
> if (bn && !msg) {
>   BATsetcount(bn, BATcount(bn)); /* set some properties */
>   bn->tsorted = true;
>   bn->trevsorted = bn->batCount <= 1;
>   bn->tkey = true;
>   bn->tseqbase = bn->batCount == 0 ? 0 : bn->batCount == 1 ? * (oid *)
> Tloc(bn, 0) : oid_nil;
> }
>
> Which I read as: if everything went well, then the result is sorted and
> key. But I miss why it should be sorted and key.

They are sorted because of the way the BAT is created.  Remember, a
select returns a "candidate list", an ordered list of matching OIDs.
The list is created by going through the OIDs of the to-be-selected bat
and adding the OID to the result when there is a match.

> Roberto
>
> _______________________________________________
> users-list mailing list
> users-list@monetdb.org
> https://www.monetdb.org/mailman/listinfo/users-list
>

--
Sjoerd Mullender
_______________________________________________
users-list mailing list
users-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/users-list