AryanBagade opened a new pull request, #18682:
URL: https://github.com/apache/datafusion/pull/18682
## Rationale for this change
This PR enforces the `clippy::needless_pass_by_value` lint rule to prevent
unnecessary data clones and improve performance in the `datafusion-datasource`
crate. This is part of the effort tracked in #18503 to enforce this lint rule
across all DataFusion crates.
Functions that take ownership of values (pass-by-value) when they only need
to read them force callers to `.clone()` data unnecessarily, which degrades
performance. By changing these functions to accept references instead, we
eliminate these unnecessary clones.
## What changes are included in this PR?
- Added lint rule enforcement to `datafusion/datasource/src/mod.rs`
- Fixed 11 violations of `clippy::needless_pass_by_value` across 5 files:
- `file_scan_config.rs`: 2 fixes
- `memory.rs`: 3 fixes
- `source.rs`: 1 fix
- `statistics.rs`: 4 fixes
- `write/demux.rs`: 1 fix
- Updated callers in `datafusion-core` and `datafusion-catalog-listing` to
pass references
## Are these changes tested?
Yes, all changes are tested:
- ✅ All 82 unit tests pass (`cargo test -p datafusion-datasource`)
- ✅ All 7 doc tests pass
- ✅ Strict clippy checks pass with `-D warnings`
- ✅ CI lint script passes (`./dev/rust_lint.sh`)
- ✅ Dependent crates (`datafusion-catalog-listing`, `datafusion-core`)
pass all tests and clippy checks
Tests are covered by existing tests as this is a refactoring that changes
internal function signatures without changing behavior.
## Are there any user-facing changes?
No user-facing changes. All changes are internal to the
`datafusion-datasource` crate. The public API remains unchanged - only internal
function signatures were modified to accept references instead of owned values.
Then at the bottom add:
Fixes #18611
Part of #18503
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]