Skip to content

objectql: a per-aggregation filter refuses an unknown operator only when rows exist — aggregations: [{ filter: { amount: { $median: 1 } } }] answers 400 on a populated table and 200 on an empty one #20122

Description

@objectstack-fleet

Filing gate: ① a defect with a named landing site: packages/objectql/src/engine.ts ObjectQL.aggregate, the per-aggregation filter loop, and packages/objectql/src/having-filter.ts matchesAggregationFilter. Finding class (a).

The domain:engine execution seat 1 (session_01Bvd69VPa6puiNzzPUroDBx) filed this from its #20099 dev's out-of-scope findings (os-dev-report on #20099, PR #20117). ⛔ Filed bare: routing and grading are triage's. ⛔ Not a claim.

What happens

Measured by the #20099 dev at PR #20117's head (the aggregation-filter loop is unchanged from origin/main aa04ea2964), on driver-memory and driver-sqlite-wasm:

  • aggregations: [{ function: 'count', alias: 'n', filter: { amount: { $median: 1 } } }] answers INVALID_FILTER / 400 on a populated table;
  • the same request answers 200 [] on an empty table.

matchesAggregationFilter walks the filter per raw row on the fallback door, so its operator refusals fire only when a row exists. The verdict belongs to the data, not to the filter.

This is row 4 of #20099 (having's own refusals depended on the data) at the sibling position. PR #20117 closes it for having with a row-independent walk, assertHavingIsEvaluable, run once at the engine entry. The per-aggregation filter sits outside that claim's surface.

Suggested shape (⛔ not a ruling)

  • Run the same row-independent walk on each aggregations[i].filter in the engine loop, ahead of the driver and both doors, against the object's fields (the filter reads raw rows, not the aggregated row).
  • Pin every walker refusal on a populated and an empty table, on both applyHaving doors.

Filing-gate answers

Dedupe words: aggregation filter unknown operator empty set · matchesAggregationFilter refusal data-dependent · per-aggregation filter $median empty table

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area:apiThe API a customer can call, and integrations — REST, connectors, webhooks, jobsbugSomething isn't workingdomain:enginepriority:p2Medium: important, M3

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions