From 537d62e8274a95248b7b946e1a80a087b07ba8f8 Mon Sep 17 00:00:00 2001 From: Andy Grove Date: Thu, 22 Jan 2026 08:54:31 -0700 Subject: [PATCH] Fix clippy warnings for Rust 1.93 - Use local `root_op` variable instead of unwrapping `exec_context.root_op` - Replace `is_some()` + `unwrap()` pattern with `if let Some(...)` Co-Authored-By: Claude Opus 4.5 --- native/core/src/execution/jni_api.rs | 10 ++-------- native/core/src/parquet/schema_adapter.rs | 5 ++--- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/native/core/src/execution/jni_api.rs b/native/core/src/execution/jni_api.rs index 56569bc69c..680cf80c75 100644 --- a/native/core/src/execution/jni_api.rs +++ b/native/core/src/execution/jni_api.rs @@ -503,12 +503,7 @@ pub unsafe extern "system" fn Java_org_apache_comet_Native_executePlan( let task_ctx = exec_context.session_ctx.task_ctx(); // Each Comet native execution corresponds to a single Spark partition, // so we should always execute partition 0. - let stream = exec_context - .root_op - .as_ref() - .unwrap() - .native_plan - .execute(0, task_ctx)?; + let stream = root_op.native_plan.execute(0, task_ctx)?; exec_context.stream = Some(stream); } else { // Pull input batches @@ -619,8 +614,7 @@ pub extern "system" fn Java_org_apache_comet_Native_releasePlan( /// Updates the metrics of the query plan. fn update_metrics(env: &mut JNIEnv, exec_context: &mut ExecutionContext) -> CometResult<()> { - if exec_context.root_op.is_some() { - let native_query = exec_context.root_op.as_ref().unwrap(); + if let Some(native_query) = &exec_context.root_op { let metrics = exec_context.metrics.as_obj(); update_comet_metric(env, metrics, native_query) } else { diff --git a/native/core/src/parquet/schema_adapter.rs b/native/core/src/parquet/schema_adapter.rs index b321d902a9..1e0d30c835 100644 --- a/native/core/src/parquet/schema_adapter.rs +++ b/native/core/src/parquet/schema_adapter.rs @@ -209,10 +209,9 @@ impl SchemaMapper for SchemaMapping { // If this field only exists in the table, and not in the file, then we need to // populate a default value for it. || { - if self.default_values.is_some() { + if let Some(default_values) = &self.default_values { // We have a map of default values, see if this field is in there. - if let Some(value) = - self.default_values.as_ref().unwrap().get(&field_idx) + if let Some(value) = default_values.get(&field_idx) // Default value exists, construct a column from it. { let cv = if field.data_type() == &value.data_type() {