Skip to content

Commit da9fb6d

Browse files
committed
style(rule): format hidden distance rewrite
1 parent b40666d commit da9fb6d

2 files changed

Lines changed: 7 additions & 5 deletions

File tree

src/rule.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -160,9 +160,9 @@ impl USearchRule {
160160
remap_projections(proj_exprs_slice, dist_alias_str, &table_ref)
161161
};
162162
let remapped_sort_exprs = remap_sort_exprs(&sort.expr, dist_alias.as_deref());
163-
let needs_hidden_distance = remapped_sort_exprs.iter().any(|e| {
164-
matches!(&e.expr, Expr::Column(c) if c.relation.is_none() && c.name == "_distance")
165-
}) && !projection_exposes_name(&final_proj_exprs, "_distance");
163+
let needs_hidden_distance = remapped_sort_exprs.iter().any(
164+
|e| matches!(&e.expr, Expr::Column(c) if c.relation.is_none() && c.name == "_distance"),
165+
) && !projection_exposes_name(&final_proj_exprs, "_distance");
166166

167167
let mut sort_input_exprs = final_proj_exprs.clone();
168168
if needs_hidden_distance {
@@ -365,7 +365,8 @@ fn projection_exposes_name(exprs: &[Expr], name: &str) -> bool {
365365
}
366366

367367
fn build_outer_projection(exprs: &[Expr]) -> Vec<Expr> {
368-
exprs.iter()
368+
exprs
369+
.iter()
369370
.filter_map(|expr| match expr {
370371
Expr::Alias(a) => Some(col(a.name.as_str())),
371372
Expr::Column(c) => Some(Expr::Column(c.clone())),

tests/execution.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -531,7 +531,8 @@ async fn exec_split_provider_select_specific_columns() {
531531
}
532532

533533
/// SELECT specific columns without projecting the distance expression.
534-
/// This is the production shape behind `vector_distance(...)`.
534+
/// This matches the split-provider direct ORDER BY shape used by callers that
535+
/// rewrite higher-level search helpers into the low-level distance UDF.
535536
#[tokio::test]
536537
async fn exec_split_provider_order_by_udf_direct() {
537538
let ctx = make_split_provider_ctx("items::vector").await;

0 commit comments

Comments
 (0)