Skip to content

Support descending CDX index tags #294

Description

@chrisrichards

Context

CdxIndex.Search throws NotSupportedException for descending indexes (a limitation inherited from the original fork, see #285), and the query planner (#291) skips them in FindEligibleTags. Likewise order by col desc never uses an index — it always sorts in memory (QueryPlanner.GetSingleAscendingOrderOrdinal).

Proposed approach

  • Cdx: support searching descending tags by inverting the comparison sign during interior descent and leaf scanning (src/DbfDataReader/Cdx/CdxIndex.cs); needs a descending fixture — none of the foxprodb tags are descending, so either craft one in VFP or gate on finding a real sample.
  • Planner: descending tags become eligible for predicates (search semantics are unchanged for equality; range bounds swap), and order by col desc can be satisfied by a descending tag — or by an ascending tag with the materialised record-index list reversed, taking care that duplicate-key runs keep the stable order the differential harness expects (QueryPlanner.StabilizeDuplicateKeyRuns).
  • Extend the QueryIndexTests differential harness accordingly.

🤖 Generated with Claude Code

Metadata

Metadata

Assignees

No one assigned

    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