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
Context
CdxIndex.SearchthrowsNotSupportedExceptionfor descending indexes (a limitation inherited from the original fork, see #285), and the query planner (#291) skips them inFindEligibleTags. Likewiseorder by col descnever uses an index — it always sorts in memory (QueryPlanner.GetSingleAscendingOrderOrdinal).Proposed approach
src/DbfDataReader/Cdx/CdxIndex.cs); needs a descending fixture — none of thefoxprodbtags are descending, so either craft one in VFP or gate on finding a real sample.order by col desccan 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).QueryIndexTestsdifferential harness accordingly.🤖 Generated with Claude Code