Skip to content

Migrate every encoding from OperationsVTable::scalar_at to probe_scalar #9971

Description

@joseph-isaacs

scalar_at receives only an ArrayView, so it doesn't cache anything — validity, child wrappers and any decode are rebuilt on every row. probe_scalar receives a ProbeState, which carries the encoding's own retained state plus a child probe per slot, so a repeated read keeps its preparation.

Example migration: #9905

Writing a probe_scalar

  • Cache in type ProbeState anything the encoding owns itself — a decoded page, a rebuilt array, a cursor. Use () when there's nothing.
  • Don't cache anything owned by a child. Read children through state.slot(..), which hands back that child's own probe and so uses the child's cache.
  • Leave scalar_at as Self::probe_scalar(&mut ProbeState::once(array), index, ctx) until the vtable method is removed.

Encodings to migrate

  • Bool
  • Constant
  • Decimal
  • Filter
  • FixedSizeList
  • Interleave
  • List
  • ListView
  • Map
  • Null
  • Patched
  • PiecewiseSequence
  • ScalarFn
  • Union
  • VarBin
  • VarBinView
  • Variant
  • ALPRD
  • BitPacked
  • ByteBool
  • DecimalByteParts
  • Delta
  • OnPair
  • ParquetVariant
  • Pco
  • RLE
  • RunEnd
  • Sequence
  • Sparse
  • TransposedBool
  • Zstd
  • ZstdBuffers
  • PythonVTable
  • NotSupported

(Primitive and Struct are done; Slice, Dict, Chunked, Shared, Masked, Extension, FoR, ZigZag, ALP, FSST, DateTimeParts are in #9905.)

Steps

  1. Migrate each encoding above, adding it to test_repeated_probe_consistency in the conformance suite.
  2. Make probe_scalar a required method; deprecate, then remove, OperationsVTable::scalar_at.
  3. Over the next few releases, remove ArrayRef::scalar_at (already deprecated) and deprecate then remove ArrayRef::is_valid / is_invalid in favour of probe() / repeated_probe().

Activity

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

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions