Skip to content

Commit b8506fe

Browse files
chore: bump Rust toolchain to 1.97.0 (paradedb#5541)
Bumps the pinned toolchain from 1.96.0 to 1.97.0, along with the `rust:1.96` base images in the proptests and stressgres Dockerfiles. 1.97 promotes several lints under our `-D warnings` clippy gate. The sites it flags are fixed here: - `float_literal_f32_fallback` — annotate the split-ratio literal as `f32` - `useless_borrows_in_formatting` — drop a redundant `&` in a `format!` arg - `unneeded_wildcard_pattern` — drop `must_not: _` covered by `..` - `for_kv_map` — iterate `values_mut()` instead of discarding the key - `byte_char_slices` — use a byte-string literal for the alias magic - `question_mark` — collapse five `if let Some(_) … else return None` blocks The `question_mark` rewrites keep the existing bail-with-`None` control flow. Verified locally: `cargo clippy --workspace --all-targets -- -D warnings` passes with 0 errors, and `cargo fmt --check` is clean. https://claude.ai/code/session_01NeoHTLLmSviDko1bNMaPPL
1 parent 1f840d6 commit b8506fe

12 files changed

Lines changed: 34 additions & 55 deletions

File tree

benchmarks/src/sample.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ pub fn run_sample(args: SampleArgs) -> Result<()> {
144144

145145
println!("Removing root table data from local disk...");
146146
std::fs::remove_dir_all(&local_root_data_path)
147-
.with_context(|| format!("Failed to remove dir: '{}'", &local_root_data_path))?;
147+
.with_context(|| format!("Failed to remove dir: '{}'", local_root_data_path))?;
148148

149149
// re-enable multi-threading
150150
conn.execute("RESET threads;", [])

docker/Dockerfile.proptests

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
# the in-cluster ParadeDB primary by the driver script (see
88
# tests/antithesis/singleton_driver_property-tests.sh).
99

10-
FROM rust:1.96-slim
10+
FROM rust:1.97-slim
1111

1212
# Required for the piped RUN below (hadolint DL4006).
1313
SHELL ["/bin/bash", "-o", "pipefail", "-c"]

docker/Dockerfile.stressgres

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
# memory: "4Gi"
1212
# cpu: "2000m"
1313

14-
FROM rust:1.96-slim-trixie
14+
FROM rust:1.97-slim-trixie
1515

1616
# Install build and runtime dependencies. Upgrade existing OS packages first so
1717
# we pick up the latest Debian security fixes regardless of the base layer's age.

pg_search/src/aggregate/mod.rs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -586,13 +586,10 @@ fn set_missing_on_terms(
586586
) {
587587
use crate::schema::SearchFieldType;
588588

589-
for (
590-
_name,
591-
Aggregation {
592-
agg,
593-
sub_aggregation,
594-
},
595-
) in aggs.iter_mut()
589+
for Aggregation {
590+
agg,
591+
sub_aggregation,
592+
} in aggs.values_mut()
596593
{
597594
if let AggregationVariants::Terms(terms) = agg {
598595
if terms.missing.is_none() {

pg_search/src/api/tokenizers/definitions.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ pub(crate) mod pdb {
8181
// Magic number: "err\0" - includes null bytes to ensure no valid text string can match
8282
// (PostgreSQL text values cannot contain embedded nulls). Prints as the string "err" if
8383
// interpreted as TEXT, making it a bit easier to catch.
84-
const ALIAS_MAGIC: u32 = u32::from_ne_bytes([b'e', b'r', b'r', b'\0']);
84+
const ALIAS_MAGIC: u32 = u32::from_ne_bytes(*b"err\0");
8585

8686
impl DatumWithType {
8787
unsafe fn new(mut datum: pg_sys::Datum, typoid: pg_sys::Oid) -> *mut Self {

pg_search/src/postgres/customscan/aggregatescan/datafusion_build.rs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1330,19 +1330,17 @@ unsafe fn build_search_filter(
13301330
let mut expr_trees: Vec<JoinLevelExpr> = Vec::new();
13311331

13321332
for &clause in clauses {
1333-
match transform_to_search_expr(
1333+
// If any clause can't be fully transformed, bail out.
1334+
// Returning None leaves the clause as "unhandled", which causes
1335+
// has_non_equi_join_quals to reject the DataFusion path.
1336+
let expr = transform_to_search_expr(
13341337
root,
13351338
clause,
13361339
&sources,
13371340
&mut temp_clause,
13381341
&mut multi_table_clauses,
1339-
) {
1340-
Some(expr) => expr_trees.push(expr),
1341-
// If any clause can't be fully transformed, bail out.
1342-
// Returning None leaves the clause as "unhandled", which causes
1343-
// has_non_equi_join_quals to reject the DataFusion path.
1344-
None => return None,
1345-
}
1342+
)?;
1343+
expr_trees.push(expr);
13461344
}
13471345

13481346
if expr_trees.is_empty() {

pg_search/src/postgres/customscan/basescan/projections/window_agg.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -331,15 +331,14 @@ unsafe fn convert_window_func_to_aggregate_type(
331331

332332
// Extract the jsonb argument (first arg)
333333
let first_arg = args.get_ptr(0)?;
334-
let json_value = if let Some(const_node) = nodecast!(Const, T_Const, first_arg) {
334+
let const_node = nodecast!(Const, T_Const, first_arg)?;
335+
let json_value = {
335336
if (*const_node).constisnull {
336337
return None;
337338
}
338339
let jsonb_datum = (*const_node).constvalue;
339340
let jsonb = <pgrx::JsonB as pgrx::FromDatum>::from_datum(jsonb_datum, false)?;
340341
jsonb.0
341-
} else {
342-
return None;
343342
};
344343

345344
// Extract solve_mvcc bool argument (second arg) if using the two-arg overload
@@ -423,10 +422,9 @@ unsafe fn extract_field_name_from_aggregate_arg(
423422
let (var, missing) =
424423
if let Some(coalesce_node) = nodecast!(CoalesceExpr, T_CoalesceExpr, arg_node) {
425424
parse_coalesce_expression(coalesce_node).ok()?
426-
} else if let Some(var) = nodecast!(Var, T_Var, arg_node) {
427-
(var, None)
428425
} else {
429-
return None;
426+
let var = nodecast!(Var, T_Var, arg_node)?;
427+
(var, None)
430428
};
431429

432430
// Get heaprelid from the rtable using VarContext

pg_search/src/postgres/customscan/joinscan/planning.rs

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,8 @@ pub(super) unsafe fn collect_join_sources_base_rel(
236236
let mut state = QualExtractState::default();
237237
// Extract search-capable predicates all at once. This is required
238238
// for score filters, which must wrap the rest of the search query.
239-
if let Some(qual) = extract_quals(
239+
// Fail the JoinScan if any search predicate cannot be extracted.
240+
let qual = extract_quals(
240241
&context,
241242
rti,
242243
classified.search_ri.as_ptr().cast(),
@@ -245,15 +246,11 @@ pub(super) unsafe fn collect_join_sources_base_rel(
245246
false,
246247
&mut state,
247248
true,
248-
) {
249-
let query = SearchQueryInput::from(&qual);
250-
side_info = side_info.with_query(query);
251-
if state.uses_our_operator {
252-
side_info = side_info.with_search_predicate();
253-
}
254-
} else {
255-
// Fail the JoinScan if any search predicate cannot be extracted.
256-
return None;
249+
)?;
250+
let query = SearchQueryInput::from(&qual);
251+
side_info = side_info.with_query(query);
252+
if state.uses_our_operator {
253+
side_info = side_info.with_search_predicate();
257254
}
258255
}
259256
}

pg_search/src/postgres/customscan/joinscan/predicate.rs

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -243,17 +243,14 @@ pub unsafe fn transform_to_search_expr(
243243
let list = PgList::<pg_sys::Node>::from_pg(node as *mut pg_sys::List);
244244
let mut children = Vec::new();
245245
for item in list.iter_ptr() {
246-
if let Some(child_expr) = transform_to_search_expr(
246+
let child_expr = transform_to_search_expr(
247247
root,
248248
item,
249249
sources,
250250
join_clause,
251251
multi_table_predicate_clauses,
252-
) {
253-
children.push(child_expr);
254-
} else {
255-
return None;
256-
}
252+
)?;
253+
children.push(child_expr);
257254
}
258255
return if children.is_empty() {
259256
None
@@ -274,17 +271,14 @@ pub unsafe fn transform_to_search_expr(
274271
pg_sys::BoolExprType::AND_EXPR | pg_sys::BoolExprType::OR_EXPR => {
275272
let mut children = Vec::new();
276273
for arg in args.iter_ptr() {
277-
if let Some(child_expr) = transform_to_search_expr(
274+
let child_expr = transform_to_search_expr(
278275
root,
279276
arg,
280277
sources,
281278
join_clause,
282279
multi_table_predicate_clauses,
283-
) {
284-
children.push(child_expr);
285-
} else {
286-
return None;
287-
}
280+
)?;
281+
children.push(child_expr);
288282
}
289283
if children.is_empty() {
290284
None

pg_search/src/query/mod.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -464,12 +464,7 @@ impl SearchQueryInput {
464464
use crate::MORE_LIKE_THIS_SELECTIVITY;
465465

466466
match self {
467-
SearchQueryInput::Boolean {
468-
must,
469-
should,
470-
must_not: _,
471-
..
472-
} => {
467+
SearchQueryInput::Boolean { must, should, .. } => {
473468
// AND: product of children selectivities; OR: max of children selectivities.
474469
let must_sel = must
475470
.iter()

0 commit comments

Comments
 (0)