Skip to content

Generic xsd:duration does not round-trip on the binary index path (decode stub returns Null) #1326

Description

@bplatz

Problem

Generic xsd:duration values are stored as canonical strings in the string dict at index build (resolver.rs, DurationStr arm — chosen because general durations have no total order), under OType::XSD_DURATION. But the binary decode path is a stub:

// fluree-db-binary-index/src/read/binary_index_store.rs (~:856)
DecodeKind::Duration => {
    // Compound duration — not yet fully supported in V5 either.
    Ok(FlakeValue::Null)
}

So an indexed generic duration decodes as Null on any binary-cursor read — the value is effectively lost after reindex on that path. (xsd:yearMonthDuration and xsd:dayTimeDuration are unaffected: they have inline order-preserving encodings and decode correctly.)

Knock-on effects

  • Overlay translation deliberately keeps FlakeValue::Duration in the unsupported set (value_to_otype_okey catch-all comment): translating a novelty duration into a binary row would lose the value, while the raw-flake merge path preserves it. Fixing the decode is the prerequisite for translating durations and removing them from the raw-flake lane.

Fix sketch

The stored o_key is a string dict id holding the canonical lexical form, so decode can resolve the string and parse it back (Duration::parse of the canonical string), mirroring how the value was written. Then add the matching translation arm (canonicalize → resolve_string_v3, which already covers dict-novelty strings).

Acceptance

  • Insert → reindex → SELECT round-trips a generic xsd:duration value on the binary path.
  • Novelty durations translate into V3 overlay ops instead of taking the raw-flake lane.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working as expected

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions