Skip to content

Upgrade math.gl to ^5.0.2 and consolidate Arrow SQL execution - #4611

Open
ibgreen wants to merge 7 commits into
masterfrom
codex/math-gl-5.0.2
Open

ibgreen wants to merge 7 commits into
masterfrom
codex/math-gl-5.0.2

Conversation

@ibgreen

@ibgreen ibgreen commented Nov 23, 2026 •

Copy link
Copy Markdown
Collaborator

Upgrade loaders.gl to math.gl ^5.0.2 from current master and remove duplicate Arrow SQL execution.

  • Resolve all seven direct math.gl dependencies to 5.0.2 in the lockfile.
  • Use math.gl for residual Arrow grouping, ordering, aggregates, and UNION ALL, including timestamp keys.
  • Remove the separate predicate compatibility path for table and streaming Arrow queries.
  • Retain native Arrow aggregate types and document the COUNT and empty aggregate results.

Lint, lockfile validation, and the 404 KiB scan bundle budget passed locally. GitHub CI runs the tests.

Supersedes draft #4610.


Note

Medium Risk
Alters Arrow query execution and return types (notably changing COUNT to bigint and throwing on division by zero), which could impact consumers expecting legacy output formats.

Overview
Upgrades @math.gl workspace dependencies to ^5.0.2 and delegates Arrow SQL relational operations—including grouping, ordering, aggregates, expressions, and unions—directly to math.gl.

Removes custom JavaScript fallback execution and predicate compatibility layers from table and streaming batch query workflows. Relational queries now adopt upstream Arrow behavior: COUNT aggregates return Int64 (bigint) values, empty ungrouped aggregates yield a single row with null metric values, and division by zero throws a SQL evaluation error.

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

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 54db90c. Configure here.

@ibgreen ibgreen left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Verified the Chromium import blocker on the replacement PR against published math.gl 5.0.2.

Comment thread modules/core/package.json
"@math.gl/tasks": "^5.0.0",
"@math.gl/core": "^5.0.2",
"@math.gl/geometry": "^5.0.2",
"@math.gl/geospatial": "^5.0.2",

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Chromium shard 4 still fails before public-query.spec.ts collects tests: the ST_MAKEPOINT import reaches polygon-clipping, and Vite serves the raw UMD file without an ESM default export.

I reran the #4610 diagnosis with published math.gl 5.0.2 and Vite 8.3.5. With noDiscovery: true and a fresh cache, the baseline reproduces that error; adding only '@math.gl/geospatial > polygon-clipping' to the browser optimizeDeps.include makes the transformed import pass and ST_MAKEPOINT return the expected native GeoArrow point, even when the dependency is installed only under @math.gl/geospatial. Please add that entry next to the existing nested include and rerun this spec in Chromium. This verifies the isolated module path, not the full shard.

@ibgreen ibgreen left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Shard 4 now passes all 20 public-query tests. The remaining shard 2 failure is a different Arrow fixture.

);
expect(toRows(grouped)).toHaveLength(1);
expect(toRows(grouped)[0].rows).toBe(2);
expect(toRows(grouped)[0].rows).toBe(2n);

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Chromium shard 2 fails before this assertion: Arrow infers bare Uint8Array[] as Struct<{0:Float64, 1:Float64}>, not Binary. Could we use arrow.tableFromArrays for the grouped fixture and set bytes to arrow.vectorFromArray([new Uint8Array([1, 2]), new Uint8Array([1, 2])], new arrow.Binary())? I replayed the same date/bytes/null grouping in published math.gl 5.0.2 with Arrow 21.2.0: the original fixture throws, and explicit Binary returns one group with count 2n. That tests the supported binary key without changing the SQL executor.

@ibgreen

ibgreen commented Nov 23, 2026

Copy link
Copy Markdown
Collaborator Author

Compared the complete diff and review feedback from #4610 (45911d6) against this PR (8a58e4a). All useful changes are accounted for here: upstream relational Arrow execution, native aggregate result types, boundary/regression tests, and upgrade guidance. This revision additionally removes obsolete predicate compatibility code and includes the polygon-clipping browser prebundle fix requested in the older review. The remaining differences deliberately use math.gl 5.0.2 and its validation/division semantics. No additional cherry-pick is needed. Closing #4610 as superseded; CI monitoring continues here.

@ibgreen ibgreen left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Shard 2 is fixed; shard 3 exposes a separate regression in the existing temporal predicate contract.

: executeArrowQuery,
executeArrowQuery
);
return planAndQueryArrowTable(source, options, executeArrowQuery, executeArrowQuery);

@ibgreen ibgreen Nov 23, 2026 •

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Chromium shard 3 fails three pre-existing temporal predicate cases. I replayed them through both the direct and streamed public wrappers with math.gl 5.0.2: DateDay equality with a noon Date incorrectly selects day zero; numeric 86_400_000 fails to select the next midnight; a numeric noon bound on TimestampMicrosecond throws Invalid temporal epoch value. The hosted test fails on the direct assertion before it reaches streaming, but both paths reproduce.

Can we retain a narrowly selected Date/Timestamp portable predicate path in both callers until a published math.gl fix preserves these millisecond semantics? The relational executor can still move to math.gl. Keep the existing result assertions, including the null row and streaming half.

I also validated that narrow fallback in a local build from this exact head: prefilter Date/Timestamp with the existing portable filter, then hand the remaining query to math.gl without where. All three cases passed direct, streamed and direct with orderBy. A separate streamed check preserved metadata on an initial empty batch and closed input at the global row limit. Full Chromium and the bundle budget still need rerunning.

This branch has not been deployed

No deployments
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.

1 participant