Skip to content

query: xsd:float first-class on the EncodedLit (binary-store) path #1470

Closed

Description

@aaj3f

Bonus finding from the PR #1462 review verification (not in the original review); caveated in the PR description. PR-X2 made xsd:float first-class via ComparableValue::Float, but only on the Binding::Lit/constant path (lit_to_comparable, eval.rs:452). The EncodedLit path (eval.rs:150-173) decodes via ComparableValue::try_from(&val) → Double (the TryFrom has no Float tagging and ignores dt_id). So a stored xsd:float materializing as a late-decoded Binding::EncodedLit (binary-store) becomes Double, never Float: ?f + ?f on an encoded float yields xsd:double not xsd:float. (B1's numeric-builtin fix isn't affected — ABS gets a Double and works — but the result type is wrong.)

Why deferred (and consistent with an existing, documented scope line): this is the SAME root cause as the deferred scan-path EncodedLit datatype-carry family the PR already labels D5b (eq-4, open-eq-02/05/06, dawg-lang-3, quotes-3/4, eq-graph-*) — the encoded/binary-index path deliberately doesn't carry datatype to avoid risking the hot path. So this is not a new hole; it's the arithmetic-typing face of that same deferral. Consider making this the umbrella issue for the whole encoded-path datatype-carry cluster (cross-reference the D5b register entries).

Second manifestation, same root cause + same fix: a lang-tagged literal on the encoded path reads as string-truthy in comparable_effective_bool instead of raising a type error (the documented untested EBV corner). Carrying dt_id/lang_id on decode resolves both this and the xsd:float typing — fold both in here so it doesn't resurface as a stray third issue.

Fix direction: carry dt_id/lang_id from the encoded value on the EncodedLit decode arm (tag Float for xsd:float; preserve lang for the EBV corner), within the binary-index perf budget.

Acceptance: ?f + ?f on an encoded xsd:float yields xsd:float; a lang-tagged encoded literal's EBV is a type error (not string-truthy); encoded and Lit paths agree; perf within budget.

(Related PR-description action: the xsd:float caveat is being sharpened to state explicitly that type-preservation holds on the Lit/query path but NOT the indexed/EncodedLit path — so "first-class" doesn't oversell.)

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