Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add metrics for UnnestExec #8482

Merged
merged 1 commit into from
Dec 14, 2023
Merged

Conversation

simonvandel
Copy link
Contributor

Which issue does this PR close?

Closes #8481.

Rationale for this change

See #8481

What changes are included in this PR?

Adds a new UnnestMetrics struct to collect metrics.

Are these changes tested?

Yes, added a DF test.
I'm not sure if there are better places to have this kind of test.
I saw that there are similar explain-tests for SQL. However, unnest is not yet implemented for SQL.

Are there any user-facing changes?

Yes, additional metrics now show up in EXPLAIN ANALYZE queries.

@github-actions github-actions bot added the core Core DataFusion crate label Dec 9, 2023
Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for this contributuion @simonvandel -- very nice 👍

let formatted = arrow::util::pretty::pretty_format_batches(&results)
.unwrap()
.to_string();
assert_contains!(&formatted, "elapsed_compute=");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

}

#[derive(Clone, Debug)]
struct UnnestMetrics {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has some overlap with BaselineMetrics, it might be able to be combined if you wanted to reduce the code size somewhat

https://docs.rs/datafusion/latest/datafusion/physical_plan/metrics/struct.BaselineMetrics.html

self.num_output_batches,
self.num_output_rows,
self.unnest_time,
produced {} output batches containing {} rows in {}",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@comphead comphead merged commit 72e39b8 into apache:main Dec 14, 2023
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Core DataFusion crate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

UnnestExec does not report metrics
3 participants