Skip to content

Migrate NEAREST to a registered expander with capability-driven LATERAL fallback #142

Description

@conradbzura

Description

Implement the generic NEAREST expander, which produces the LATERAL + SELECT AST, with a capability-driven fallback to a window-function form for targets whose supports_lateral capability is false. Materialize the row passthrough and the synthesized distance column as AST so NEAREST's output handling no longer lives in the string emitter. Flip GIQL_EXPAND on GIQLNearest and delete giqlnearest_sql.

Motivation

NEAREST is the first operator whose expansion is genuinely capability-conditional, exercising the capability model that lets one operator serve engines with differing feature support.

Expected Outcome

NEAREST transpiles through the registry; lateral-capable targets receive the LATERAL form and others the window-function fallback; results are identical across DuckDB and DataFusion and unchanged; giqlnearest_sql is removed.

Metadata

Metadata

Assignees

Labels

refactorCode restructuring without behavior change

Type

No type
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