squirreling 0.12.12 → 0.12.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "squirreling",
3
- "version": "0.12.12",
3
+ "version": "0.12.13",
4
4
  "description": "Squirreling Async SQL Engine",
5
5
  "author": "Hyperparam",
6
6
  "homepage": "https://hyperparam.app",
@@ -102,7 +102,7 @@ export function executeHashAggregate(plan, context) {
102
102
  group.push(row)
103
103
  }
104
104
 
105
- /** @type {{ row: AsyncRow, group: AsyncRow[], contextRow: AsyncRow }[]} */
105
+ /** @type {{ row: AsyncRow, rows: AsyncRow[], outputRow: AsyncRow }[]} */
106
106
  const aggregateRows = []
107
107
 
108
108
  for (const group of groups.values()) {
@@ -120,24 +120,19 @@ export function executeHashAggregate(plan, context) {
120
120
  if (!passes) continue
121
121
  }
122
122
 
123
- aggregateRows.push({ row: asyncRow, group, contextRow })
123
+ aggregateRows.push({ row: contextRow, rows: group, outputRow: asyncRow })
124
124
  }
125
125
 
126
- if (plan.orderBy?.length) {
127
- const sortedRows = await sortEntriesByTerms({
128
- entries: aggregateRows.map((aggregateRow, idx) => ({
129
- row: aggregateRow.contextRow,
130
- rows: aggregateRow.group,
131
- idx,
132
- })),
126
+ const outputRows = plan.orderBy?.length
127
+ ? await sortEntriesByTerms({
128
+ entries: aggregateRows,
133
129
  orderBy: plan.orderBy,
134
130
  context,
135
131
  })
136
- aggregateRows.splice(0, aggregateRows.length, ...sortedRows.map(({ idx }) => aggregateRows[idx]))
137
- }
132
+ : aggregateRows
138
133
 
139
- for (const { row } of aggregateRows) {
140
- yield row
134
+ for (const { outputRow } of outputRows) {
135
+ yield outputRow
141
136
  }
142
137
  },
143
138
  }