Skip to content

Commit

Permalink
feat: show executed native plan with metrics when in debug mode (apac…
Browse files Browse the repository at this point in the history
…he#746)

* show executed native plan with metrics when in debug mode

* rename variable

(cherry picked from commit 65f22a2)
  • Loading branch information
andygrove authored and huaxingao committed Aug 7, 2024
1 parent 2dd1a3f commit 798f757
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions native/core/src/execution/jni_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,15 @@ pub unsafe extern "system" fn Java_org_apache_comet_Native_executePlan(
// Update metrics
update_metrics(&mut env, exec_context)?;

if exec_context.debug_native {
if let Some(plan) = &exec_context.root_op {
let formatted_plan_str =
DisplayableExecutionPlan::with_full_metrics(plan.as_ref())
.indent(true);
info!("Comet native query plan with metrics:\n {formatted_plan_str:}");
}
}

let long_array = env.new_long_array(1)?;
env.set_long_array_region(&long_array, 0, &[-1])?;

Expand Down

0 comments on commit 798f757

Please sign in to comment.