Skip to content

L2 hardening: SampleValue resolution can bind a non-numeric label column #70

Description

@zzylol

Severity: LOW — latent (hardening)

Found in a whole-repo code review. ColumnRef::SampleValue resolution can bind to a label column when a schema has exactly one non-timestamp column and it is non-numeric.

Location

crates/l2/src/column_resolution.rs:73-78

Root cause

The SampleValue fallback order is: (1) a column named value; (2) the sole non-timestamp column regardless of type; (3) the sole numeric non-ts column. Step 2 runs before step 3, so a schema shaped [ts: Timestamp, host: Utf8] resolves SampleValue to host.

Reachability

Latent, not a live bug: no real PromQL/SQL lowering produces such a schema today (instant vectors keep value; cross-series aggregates emit [label, numeric], i.e. 2 non-ts columns, so step 3 correctly picks the numeric). Filing as hardening so the ordering can't bite a future lowering path.

Proposed fix

Fold step 2 into step 3 — require the fallback column to be numeric. Nothing the tests exercise depends on the type-agnostic step 2.

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

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions