The intermediate rdd is always cached. We should only cache it if necessary.
[Github] Pull Request #24919 (zhengruifeng)
GitHub Pull Request #24919