Re: [sqlite] [EXTERNAL] json_group_array() and sorting

2019-01-08 Thread Eric Grange
Shawn's json_group_array(json(o)) works indeed, but it's also 30% slower in my case than using '[' || ifnull(group_concat(o, ','), '') || ']' which is however more case specific and less obvious. Would be nice to see the subtype passing be improved, as otherwise query planner improvements could

Re: [sqlite] [EXTERNAL] json_group_array() and sorting

2019-01-08 Thread Dominique Devienne
On Tue, Jan 8, 2019 at 11:04 AM Dominique Devienne wrote: > > On Tue, Jan 8, 2019 at 10:50 AM Eric Grange wrote: >> >> Can someone confirm whether this is a bug ? > > > My guess is that it works as "designed", even if this is surprising... > > I believe that JSON1 leverages value "sub-types" [1],

Re: [sqlite] [EXTERNAL] json_group_array() and sorting

2019-01-08 Thread Shawn Wagner
Try using json_group_array(json(o)) On Tue, Jan 8, 2019, 1:50 AM Eric Grange Thanks. > > I think I may have encountered a "real" bug while ordering in a subquery. > I have simplified it in the following exemples: > > select json_group_array(o) from ( >select json_object( > 'id', sb.id >

Re: [sqlite] [EXTERNAL] json_group_array() and sorting

2019-01-08 Thread Dominique Devienne
On Tue, Jan 8, 2019 at 10:50 AM Eric Grange wrote: > Thanks. > > I think I may have encountered a "real" bug while ordering in a subquery. > I have simplified it in the following exemples: > > select json_group_array(o) from ( >select json_object( > 'id', sb.id >) o >from ( >

Re: [sqlite] [EXTERNAL] json_group_array() and sorting

2019-01-08 Thread Eric Grange
Thanks. I think I may have encountered a "real" bug while ordering in a subquery. I have simplified it in the following exemples: select json_group_array(o) from ( select json_object( 'id', sb.id ) o from ( select 1 id, 2 field ) sb ) the json_group_array returns an a

Re: [sqlite] [EXTERNAL] json_group_array() and sorting

2019-01-08 Thread Hick Gunter
I don't recall that any (aggregate) function is concerned at all about the order in which rows are visited. The effect is only visible in non-commutative aggregates (e.g. concatenation). If you want the arguments presented to an aggregate function in a specific order, then you need to enforce t