datafusion icon indicating copy to clipboard operation
datafusion copied to clipboard

refactor: move metrics module to `datafusion-common` crate

Open 2010YOUY01 opened this issue 2 months ago • 0 comments

Which issue does this PR close?

Rationale for this change

https://github.com/apache/datafusion/issues/18456 requires this refactor. Now we have dependency physical-plan -> physical-expr -> common, and metrics module lives in physical-plan. We want metrics module to directly accessible from physical-expr crate, so they should be moved to common crate.

For compile time concern, I've checked cargo build --profile release-nonlto --timings benchmark, compiling common crate takes 5s in 3min total, so it has no noticeable impact. They're all keep in this project wide root datafusion-common dependency for simplicity.

What changes are included in this PR?

  • Metrics module depends on memory util get_record_batch_memory_size, so it's first moved to common crate
  • Move metrics module to common crate

Above moves are all re-exported in the original place to keep the public APIs backward-compatible

Are these changes tested?

Are there any user-facing changes?

2010YOUY01 avatar Dec 10 '25 04:12 2010YOUY01