Repository navigation
Support grouped SQL on in-memory Arrow layer data - #11189
Conversation
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
[Medium impact] The reviewed changes appear safe to merge. SummaryAdds grouped SQL queries for in-memory Arrow layer data and uses them to total Mapbox visits by hexagon.
No actionable new issues found. Reviews (2) · Last reviewed commit: "Allow layer queries to wait for data" · Reviewed by Greptile |
chrisgervang
left a comment
There was a problem hiding this comment.
Reviewed daefcae after merge; follow-ups below.
No P1s.
Labels: P1 settle before this is merged, P2 can follow, Non-blocking optional.
Generated by Claude Code
| } catch (error) { | ||
| // Custom parsers own their grammar and diagnostics. | ||
| if (parse !== defaultSQLParser.parseQuery) throw error; | ||
| const {queryArrowSQL} = await import('@math.gl/sql'); | ||
| return queryArrowSQL(sql, new Map([['data', data]])); |
There was a problem hiding this comment.
P2: Queries go to math.gl only when the scan parser throws. SELECT SUM(count) AS total FROM data parses, then fails on the scan engine with Unknown Arrow function: SUM. The query docs promise relational SQL with FROM data.
- Replayed on the published math.gl rc.2 and loaders.gl rc.1 that master uses: the
GROUP BYform returns two rows, the ungrouped form throws.
Could queries with aggregate calls go to math.gl, or retry there when the scan engine rejects them?
Generated by Claude Code
Background
Grouped SQL queries on in-memory Arrow layers currently fail in the scan parser. The Mapbox example sums visits per hexagon in JavaScript.
Change List
Verified workspace and website builds, lint, and 205 Node tests.
Note
Low Risk
Low risk enhancement that adds a fallback query execution path for in-memory Arrow data and improves handling of empty inputs without altering existing scan query paths.
Overview
Adds support for relational SQL queries, such as
GROUP BYaggregations, on in-memory Arrow layer data. When the default scan parser cannot parse a query,queryLayerDatanow falls back to dynamically importing and running@math.gl/sqlacross the Arrow table.Also adds safe handling for nullish and empty array inputs in layer queries and SQL accessors, updates the Mapbox example to leverage grouped SQL queries instead of manual JavaScript aggregation, and deduplicates loader utilities by switching to
compareLoaderOptionsfrom@loaders.gl/core.Reviewed by Cursor Bugbot for commit daefcae. Bugbot is set up for automated code reviews on this repo. Configure here.