Closed efbenson closed 6 years ago
Ill take a look at those build issues in the morning
@efbenson tests are failing because the new code doesn't conform to standard.js
When your first issue was logged I started looking into a post-query iterative sort. Sorry, I didn't realize you had already started an effort. My WIP PR is here: https://github.com/koopjs/winnow/pull/86
Problem with post ordering outside the alasql is that you will have to disregard limit and process the whole feature set to make sure you order correctly. This is something brought up by it client as they use koop in AGOL and need to sort layers that are paginated.
At least right now, the limit isn't used in the SQL, because as you mentioned the SQL is being applied on a per feature basis. So I think one way forward would be to apply the sort (if options.orderByFields
is defined) prior to these loops https://github.com/koopjs/winnow/blob/master/src/executeQuery.js#L36-L41, https://github.com/koopjs/winnow/blob/master/src/executeQuery.js#L55-L59. If the feature set is big, that could be an expensive sort, but I'd big curious if it's any more expensive than what alasql is doing under the hood. @dmfenton any additional thoughts?
After more thought on this, we might the approach of capturing the essentials of the esriFy
function and pass it in as part of the pick
function in the SQL statement.
Moved the esriFy to the SQL and then was able to let SQL handle ORDER, LIMIT, OFFSET in https://github.com/koopjs/winnow/pull/90. Released in v1.6.1
changes how the query code works to keep existing manipulation, but allowing for limit/offset/order to be done by alasql