Skip to content

Commit 537d62e

Browse files
andygroveclaude
andcommitted
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 <noreply@anthropic.com>
1 parent ea26629 commit 537d62e

2 files changed

Lines changed: 4 additions & 11 deletions

File tree

native/core/src/execution/jni_api.rs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -503,12 +503,7 @@ pub unsafe extern "system" fn Java_org_apache_comet_Native_executePlan(
503503
let task_ctx = exec_context.session_ctx.task_ctx();
504504
// Each Comet native execution corresponds to a single Spark partition,
505505
// so we should always execute partition 0.
506-
let stream = exec_context
507-
.root_op
508-
.as_ref()
509-
.unwrap()
510-
.native_plan
511-
.execute(0, task_ctx)?;
506+
let stream = root_op.native_plan.execute(0, task_ctx)?;
512507
exec_context.stream = Some(stream);
513508
} else {
514509
// Pull input batches
@@ -619,8 +614,7 @@ pub extern "system" fn Java_org_apache_comet_Native_releasePlan(
619614

620615
/// Updates the metrics of the query plan.
621616
fn update_metrics(env: &mut JNIEnv, exec_context: &mut ExecutionContext) -> CometResult<()> {
622-
if exec_context.root_op.is_some() {
623-
let native_query = exec_context.root_op.as_ref().unwrap();
617+
if let Some(native_query) = &exec_context.root_op {
624618
let metrics = exec_context.metrics.as_obj();
625619
update_comet_metric(env, metrics, native_query)
626620
} else {

native/core/src/parquet/schema_adapter.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -209,10 +209,9 @@ impl SchemaMapper for SchemaMapping {
209209
// If this field only exists in the table, and not in the file, then we need to
210210
// populate a default value for it.
211211
|| {
212-
if self.default_values.is_some() {
212+
if let Some(default_values) = &self.default_values {
213213
// We have a map of default values, see if this field is in there.
214-
if let Some(value) =
215-
self.default_values.as_ref().unwrap().get(&field_idx)
214+
if let Some(value) = default_values.get(&field_idx)
216215
// Default value exists, construct a column from it.
217216
{
218217
let cv = if field.data_type() == &value.data_type() {

0 commit comments

Comments
 (0)