Skip to content

Expose RecordBatch batch_size through XarrayContext.from_dataset#250

Description

@alxmrs

馃 read_xarray_table(..., batch_size=...) exposes the source RecordBatch size, but XarrayContext.from_dataset() and _from_dataset() currently do not pass that option through.

This matters for dense-grid consumers that use the convenient context API. A quarter-degree (lat=720, lon=1440) time plane has 1,036,800 rows, so the current 65,536-row default emits about 16 source batches per time partition. A larger batch may reduce Python/Arrow crossings and downstream batch-coalescing overhead; smaller batches may be preferable under memory pressure.

Suggested API:

ctx.from_dataset(
    "canonical",
    ds,
    chunks={"time": 1},
    batch_size=262_144,
)

It should be threaded through heterogeneous dimension groups as well. The default should remain unchanged; this issue is about making the existing reader control available from the primary API and documenting the latency/memory tradeoff.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions