Skip to content

Account for null rows in Parquet dictionary-cache profitability #12115

Closed

Description

@Rich-T-kid

Problem

The dictionary-cache profitability check added in #11982 calls:

use_dictionary_cache(dictionary, values.len())

values.len() includes null rows, but write_gather only encodes the gathered dictionary indices. For a highly nullable dictionary array, a new cache with one slot per dictionary value can therefore pass the gate even when very few, or no, non-null values will use it. This can allocate approximately 8 * dictionary.len() bytes without enough encoded rows to amortize the cache.

Expected behavior

The profitability decision for a new dictionary cache should account for the rows that can actually use the cache, while preserving reuse of an existing cache for the same dictionary values.

The exact policy still needs design. Possible inputs include the gathered indices and dictionary-key validity, without adding an expensive scan that erases the optimization's benefit.

Originally noted in #11982 (comment).

Activity

  1. added a commit that references this issue on Nov 12, 2026
    da51f14
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