Skip to content

Support grouped SQL on in-memory Arrow layer data - #11189

Merged
ibgreen merged 2 commits into
masterfrom
codex/layer-grouped-arrow-query
Nov 18, 2026
Merged

ibgreen merged 2 commits into
masterfrom
codex/layer-grouped-arrow-query

Conversation

@ibgreen

@ibgreen ibgreen commented Nov 18, 2026 •

Copy link
Copy Markdown
Collaborator

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

  • Route relational Arrow queries to math.gl's SQL executor
  • Group Mapbox visitor counts by hexagon
  • Unit tests for groups spanning Arrow batches
  • Documentation for grouped layer queries

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 BY aggregations, on in-memory Arrow layer data. When the default scan parser cannot parse a query, queryLayerData now falls back to dynamically importing and running @math.gl/sql across 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 compareLoaderOptions from @loaders.gl/core.

Reviewed by Cursor Bugbot for commit daefcae. Bugbot is set up for automated code reviews on this repo. Configure here.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-18T15:25:21.792731Z 5510e3c PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@greptile-apps

greptile-apps Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The reviewed changes appear safe to merge.

Summary

Adds grouped SQL queries for in-memory Arrow layer data and uses them to total Mapbox visits by hexagon.

  • Layers can group rows from in-memory Arrow tables with SQL.
  • The SQL accessor docs explain what fractional list indexes return.
  • Layer data requests use loaders.gl's shared option comparison.

No actionable new issues found.

Reviews (2) · Last reviewed commit: "Allow layer queries to wait for data" · Reviewed by Greptile

@coveralls

coveralls commented Nov 18, 2026 •

Copy link
Copy Markdown

Coverage Status

coverage: 82.598% (-0.01%) from 82.612% — codex/layer-grouped-arrow-query into master

@ibgreen ibgreen mentioned this pull request Nov 18, 2026
14 of 70 tasks
@ibgreen
ibgreen merged commit 8fccecf into master Nov 18, 2026
9 checks passed
@ibgreen
ibgreen deleted the codex/layer-grouped-arrow-query branch November 18, 2026 16:26

@chrisgervang chrisgervang left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Comment on lines +41 to +45
} 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]]));

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 BY form 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants