RFC: arrow.Table support

Open
#11,069 2 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
25/100
Issue type
Feature
Clarity
Clearly specified
Activity status
Active
Tech stack
typescript

Research direction

Start with the core Layer lifecycle and column preparation helpers, then trace the existing Arrow converter and column definitions for vectorized layers. The RFC divides the work into independently landable preparation PRs and later Table integration; choose a specific checklist item before changing code. Done means its listed compatibility, precedence, lifecycle, or consumer tests pass while existing behavior is preserved.

Written by the indexing model from the issue text.

Description

Proposal

Allow Arrow-equipped layers to accept an Apache Arrow Table through data. Resolve each supported plural column prop using this precedence:

  1. Explicit non-null Arrow column or GPUVector
  2. Compatible same-named column in the loaded data table
  3. Existing binary attribute, accessor, and default fallback

Match exact public column names, such as positions, fillColors, and radii. Ignore incompatible table fields; reject invalid explicit inputs. Once a compatible field is selected, conversion errors (including unsupported null values) remain errors rather than silently falling back.

new ScatterplotLayer({
  data: table,
  fillColors: explicitColors,
  getRadius: row => row.population / 1000
});

Here positions may come from table.positions; explicit fill colors win; compatible table.radii wins over getRadius.

Architecture

Keep selection separate from conversion and rendering. Add a small core resolver exposed through a protected Layer helper. Layers supply existing column definitions and specialized compatibility predicates. The resolver inspects schema metadata without GPU allocations, row materialization, prop mutation, registration, or caching.

Share numeric compatibility rules with the Arrow converter. Geometry, Bitmap mesh, and DGGS inputs retain their specialized contracts. Pass resolved inputs into existing preparation helpers, including column-mode detection; do not overwrite layer props. Preserve ownership, aligned chunks, picking, bounds, and existing extension/transition limitations.

Expand public data types to accept Table using type-only imports. Recognize tables structurally to support multiple installed Arrow copies.

Async behavior

Use Layer's existing async data lifecycle. Resolve columns from the loaded value after dataTransform, supporting direct tables, promised tables, and loader results. Retain previous valid rendering during replacement; commit converted resources atomically; discard stale loads/conversions. Include conversion in isLoaded while retaining existing onDataLoad semantics. Switching tables, schemas, or ordinary row data must correctly enter or leave column mode.

Automatic accumulation of async iterators yielding tables/record batches is deferred: the existing row-array concatenation path needs a separate Arrow accumulation contract.

Source and column queries

Proposed follow-up after table-backed column resolution lands. Both props use structured loaders.gl query objects.

  • query requests source-side pushdown through a query-capable loaders.gl source. Use it to reduce or shape what the source returns, for example by projecting fields or filtering records before transfer. A change to query reloads the source. Report unsupported source queries explicitly.
  • columnQuery transforms the loaded Arrow table after dataTransform and before the layer resolves columns. Use it to compute or rename fields such as positions and radii, or to filter or reorder rows locally. A change to columnQuery reuses the loaded source and updates layer inputs.

The pipeline is source query → loaded data → dataTransform → columnQuery → column resolution. Explicit column props take precedence and must match the resulting rows in count and order. Accessor fallbacks, instance counts, and picking use the resulting table and its row order. props.data and onDataLoad refer to the loaded source data. isLoaded includes column query evaluation and GPU preparation.

Use the loaders.gl Arrow evaluator for the initial columnQuery backend. It can materialize rows depending on the operators. A future GPUDataFrame evaluator could implement the same layer-facing contract. GPU execution and streaming evaluation are follow-ups.

Independently landable prep PRs

Each PR should reference this RFC with Refs #<this issue> rather than closing it, include relevant TSDoc and developer/API documentation, and preserve existing behavior until the final integration.

  • 1. Extract schema compatibility checks. Reuse allocation-free converter validation for scalar, position, color, and fixed-width numeric vectors. Document accepted schemas and schema-versus-value validation. Test supported widths, child types, and existing conversion errors.
  • 2. Separate column selection from preparation. Introduce the internal core resolver and protected Layer boundary. Initially resolve explicit inputs only, keeping behavior unchanged. Document the selection contract; test explicit inputs and internal prop: false exclusions.
  • 3. Consume resolved inputs consistently. Adapt LayerColumns and existing instanced layers so initialization, model selection, conversion, and accessor fallback share the selected inputs. Document helper responsibilities. Preserve current explicit-column behavior with backend lifecycle tests.
  • 4. Harden async replacement lifecycle. Test/fix data-load and conversion races, failed replacement, finalization, empty results, first draw, and isLoaded. Document callback/loading semantics. This improves existing explicit-column handling independently of table discovery.
  • 5. Add specialized resolver adapters. Reuse the selection boundary in Bitmap, mesh, DGGS, and Storage helpers, initially retaining explicit-input behavior. Document topology, cell schemas, and ownership constraints; test representative consumers.

Feature PRs after preparation

  • 6. Enable Table fallback in standard vectorized layers. Add Table data typing, same-name compatible-field lookup, and accessor rows via table.get(index). Add the shared Arrow guide, precedence examples, and per-layer links. Test direct/promised/transformed tables, explicit overrides, schema changes, chunks, and picking on WebGL/WebGPU.
  • 7. Enable specialized consumers. Apply table discovery to Bitmap, DGGS, and Storage inputs using their adapters. Document layer-specific requirements and test topology, per-feature styling/picking, and ownership.

Verification

Concentrate precedence and race coverage in core, with small smoke tests for each consumer and representative WebGL/WebGPU rendering/picking tests. Verify caller resources survive, failed replacements retain prior resources, and uniform-only updates do not re-upload geometry. Run relevant tests, yarn build, yarn lint, and yarn test-website for each applicable PR. Keep examples and existing golden images unchanged.

Scope decisions

No AttributeManager routing for typed inputs, new registration system, new barrel module, implicit GPU readback, mixed chunk structures, automatic seam handling, or relaxed topology contracts. Discuss any broader changes separately.

Dominant language
TypeScript
Stars
14.8k
Forks
2.3k
Avg merge
1d 9h
Merged PRs (30d)
230

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from visgl/deck.gl

All issues in visgl/deck.gl

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.